I have two tables,namely booking and ledger.
booking table:
BookingID -- RegularPrice -- DownPayment -- PerMonthInstallment
1 100,000 10,000 7,500
ledger table:
BookingID Voucher -- PaymentType -- Amount
1 1 Down Payment 10,000
1 2 Installment 7,500
Current output is;
PaymentType -- PerMonthInstallment -- PaidAmount
Down Payment 7,500 7,500
Installment#1 7,500 7,500
What i want is, if PaymentType is Down Payment then in the PerMonthInstallment column, the value should be 10,000 rather than 7,500.
PaymentType -- PermonthInstallment -- PaidAmount
Down Payment 10,000 10,000
Installment#1 7,500 7,500
My Query:
SELECT booking.BookingID,
booking.PerMonthInstallment,
ledger.PaymentType,
ledger.PaidAmount,
ledger.Voucher
from booking
INNER JOIN ledger ON booking.BookingID = ledger.BookingID