Query Only Specified Number Of Items From Parent/Child Categories

Posted by RogeR on Stack Overflow See other posts from Stack Overflow or by RogeR
Published on 2010-05-14T20:59:46Z Indexed on 2010/05/14 21:04 UTC
Read the original article Hit count: 319

Filed under:
|
|

I'm having trouble figureing out how to query every item in a certain category and only list the newest 10 items by date. Here is my table layout:

download_categories

category_id (int) primary key title (var_char) parent_id (int)

downloads

id (int) primary key title (var_char) category_id (int) date (date)

I need to query every file in a main category that lets say has 100 items and 5 child categories and only spit out the last 10 added. I have functions right now that just add up all the files so I can get a count by category, but I can't seem to modify the code to only display a certain amount of items based on the date.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql