A
Anonymous
Guest
hello all,
i have a query question. I have 2 tables, userdetails and payments. i have a script that grabs payments for all users based on date range selected:
SELECT payments.userid, payments.amount, payments.date, payments.subscrID, payments.txnid, userdetails.userDeactivate FROM payments LEFT JOIN userdetails ON payments.userid = userdetails.userid WHERE payments.date >= '$dateStart' AND payments.date <= '$dateEnd' ORDER BY $orderBy
i need to change the query to have the same functionality BUT look at last two payments for each userid that had a payment in the selected date range and compare the payments.subscrID if they are the same. if they are, i need to output YES, if they are different, output will be NO in the output.
right now my output is:
userid, amount, date, txnid, subscrID, userDeactivate
and need it to be;
userid, amount, date, txnid, subscrID, userDeactivate, YES/NO
... i can figure out how to do this so ANY help is much appreciated
i have a query question. I have 2 tables, userdetails and payments. i have a script that grabs payments for all users based on date range selected:
SELECT payments.userid, payments.amount, payments.date, payments.subscrID, payments.txnid, userdetails.userDeactivate FROM payments LEFT JOIN userdetails ON payments.userid = userdetails.userid WHERE payments.date >= '$dateStart' AND payments.date <= '$dateEnd' ORDER BY $orderBy
i need to change the query to have the same functionality BUT look at last two payments for each userid that had a payment in the selected date range and compare the payments.subscrID if they are the same. if they are, i need to output YES, if they are different, output will be NO in the output.
right now my output is:
userid, amount, date, txnid, subscrID, userDeactivate
and need it to be;
userid, amount, date, txnid, subscrID, userDeactivate, YES/NO
... i can figure out how to do this so ANY help is much appreciated