Sometimes one transaction affects more than two accounts. This is called a compound journal entry.
Example: Received Rs.9,500 from Mohan in full settlement of Rs.10,000.
Cash A/c Dr. Rs.9,500
Discount Allowed A/c Dr. Rs.500
To Mohan A/c Rs.10,000
Cash received is debited. Discount allowed is a loss, so it is debited. Mohan's account is credited because his receivable is settled.
Total debit = Rs.9,500 + Rs.500 = Rs.10,000. Total credit = Rs.10,000. So the entry is balanced.
Another example: Bought goods Rs.10,000 plus GST 18% for cash.
Purchases A/c Dr. Rs.10,000
Input GST A/c Dr. Rs.1,800
To Cash A/c Rs.11,800
Purchases increased. Input GST is claimable tax credit. Cash went out.