I have 2 tables joined by the membership.ID and memberDues.memberID. The membership table has a column, firstLast, which is unique for each row. If I have a value for firstLast, i should be able to then find the membership.ID and compare it to the memberDues.memberID. I am using the following query but it doesn't work:
SELECT * FROM memberDues, membership
WHERE memberID =
( SELECT ID FROM membership
WHERE firstLast = 'Jim Smith')
ORDER BY payDate DESC
LIMIT 1
The result gets the correct memberDues.memberID and the other data from its row but pulls an unrelated data set from the membership table where even the ID is wrong. What's wrong with the query?