dumdumsareyum Posted June 13, 2008 Share Posted June 13, 2008 I would like to write a query that would get the first 4 rows for each different category i have listed...for example, say I have photos stored with a column called 'category', i would like to retreive the first 4 entries for each unique category listed in the column. I was thinking about just getting a list of distinct categories, then running a query on each with a limit of 4, but i'd like to know if there is a way to do it all at once. thanks Quote Link to comment https://forums.phpfreaks.com/topic/110104-query-help/ Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 There is, but it's not pretty... there are all sorts of ways to cheat; the laziest is simply to throw out anything after the 4th. Quote Link to comment https://forums.phpfreaks.com/topic/110104-query-help/#findComment-565097 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.