Hi all,
I have the following query, as simple as it gets:
$sql = mysql_query("SELECT * FROM news ORDER BY category, id DESC");
This will output:
WORLD NEWS
story 1
story 2
story 3
story 4
LOCAL NEWS
story 1
story 2
story 3
story 4
story 5
TECH NEWS
story 1
story 2
story 3
What I want is to limit the output of EACH category by 3 so I get:
WORLD NEWS
story 1
story 2
story 3
LOCAL NEWS
story 1
story 2
story 3
TECH NEWS
story 1
story 2
story 3
Obviously:
$sql = mysql_query("SELECT * FROM news ORDER BY category, id DESC LIMIT 3");
Just gives:
WORLD NEWS
story 1
story 2
story 3
Hope this makes sense, any ideas how I can achieve this?
Thanks