AmandaBTO Posted October 17, 2009 Share Posted October 17, 2009 An example of my data id - name - img - date 88 - Transformers: The Complete Series - 51NkgXkcBdL.jpg - 2009-10-17 11:42:27 89 - Transformers: Revenge of the Fallen - 613JpLLDqXL.jpg - 2009-10-17 11:44:24 90 - I Love You Man - 51JCT4GYZuL.jpg - 2009-10-17 12:15:32 91 - Transformers: Revenge of the Fallen - 613JpLLDqXL.jpg - 2009-10-17 12:58:08 92 - Transformers: Revenge of the Fallen - 613JpLLDqXL.jpg - 2009-10-17 12:58:09 93 - Transformers: Revenge of the Fallen - 613JpLLDqXL.jpg - 2009-10-17 12:58:10 I know how to select the 3 most recent rows SELECT * FROM table ORDER BY date DESC LIMIT 3 But how can I get the 3 most recent unique (except for date) rows? I've been playing all morning and I'm either really close to figuring it out or I'm completely off. Thanks Amanda Quote Link to comment https://forums.phpfreaks.com/topic/178039-solved-sql-to-get-most-recent-unique-rows/ Share on other sites More sharing options...
AmandaBTO Posted October 17, 2009 Author Share Posted October 17, 2009 Yay, I found the most fantastic little article: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ Inner join is the answer Thanks Quote Link to comment https://forums.phpfreaks.com/topic/178039-solved-sql-to-get-most-recent-unique-rows/#findComment-938743 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.