The purpose of the query is to be able to run reports to see when to bill customers. When the customer file is created, they can break up their initial fee into 4 payments; however, some pay in full, some in 2 payments, etc.
The table is like this:
payment1_amount | payment1_duedate | payment2_amount | payment2_duedate | etc.
150.00 02/02/2014 175.00 02/27/2014
I tried running:
SELECT lead_id,COALESCE(payment1_amount, payment2_amount) B FROM table WHERE payment1_duedate = '$today' OR payment2_duedate = '$today'
This will display the correct date (if it's today) but it only selects the first payment. So today's payment is on the payment2_duedate/payment2_
amount - it displays as payment2_duedate/payment1_
I tried playing with unions and joins, but just can't get it sorted out - and Google is failing me right now :) Thanks!