This should work.. I hope
Lets get away from the idea of an aggregate and just use a subquery then
SELECT m.memberID, m.firstname, m.lastname,
t.transactionID as maxTransactionID,
t.paidthru as paidthru
FROM members m
INNER JOIN trans t ON m.memberID = t.memberID
WHERE transactionI
I know why you are getting the results you are getting but I do not have enough information regarding your data to provide a solution yet.
If you add t.paidthru in your group by clause then it will get multiple entries (a cross-join), but if you leave it out you will get invalid
group by errors.
I know why you are getting the results you are getting but I do not have enough information regarding your data to provide a solution yet.
If you add t.paidthru in your group by clause then it will get multiple entries (a cross-join), but if you leave it out you will get invalid group by errors.
I left a lot of your query out but you should be able to look at this and see the biggest differences.
SELECT m.memberID, m.firstname, m.lastname,
MAX(t.transactionID) as maxID
FROM members m
INNER JOIN trans t ON t.memberID = m.memberID
GROUP BY m.memberID, m.firstname, m.lastname
Hope t
4 matches
Mail list logo