ragrim Posted June 25, 2011 Share Posted June 25, 2011 Hi, I need some help with my query, i have 3 tables, subscribers, subscriber numbers and subscriber transactions. the sub numbers is a lookup table to link transactions and subscribers. what i want is to only pull the last record for each person from subscriber transactions. heres what i have atm. SELECT userinfo.FirstName, userinfo.LastName, subscribernumbers.SubNumber, subtransactions.TransDate, subtransactions.PaymentType FROM userinfo INNER JOIN subscribernumbers ON userinfo.User_ID = subscribernumbers.FKUserID INNER JOIN subtransactions ON subtransactions.FKSubNum = subscribernumbers.SubNumber Quote Link to comment Share on other sites More sharing options...
ebmigue Posted June 25, 2011 Share Posted June 25, 2011 This is similar to http://www.phpfreaks.com/forums/index.php?topic=336635.msg1586460#msg1586460 I trust that you can figure out the answer on your own. Hope it helps. Quote Link to comment Share on other sites More sharing options...
ragrim Posted June 25, 2011 Author Share Posted June 25, 2011 Thanks for the reply, That topic seems similar but doesnt seem to help me. i have built a query for this purpose once before but cant remember it. i thought i needed a order by and limit 1 somewhere to make it work. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 2, 2011 Share Posted July 2, 2011 You need to isolate a unique group first, and then join upwards. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.