The following query is intended for a pagination script that is to return news posts from a DB. It works, but does not return any items with same dates, or title.
How do I rewrite this in order to get items with same title and/or same date?
Query:
"SELECT p.post_id, p.post_title, p.post_detail, p.post_user, p.post_slug, p.post_date, p.post_type
FROM ".TBL_POSTS." as p
LEFT JOIN ".TBL_POST_CATEGORIES." as c
ON c.post_ID = p.post_id
WHERE p.post_type = 'post' AND c.category_ID = 5
GROUP BY p.post_date DESC", 10);
Here is an example of the POST table
--------------------------------------------
post_id | post_title | post_date
--------------------------------------------
10 | news post 1 | 2014-02-13 21:09:45
--------------------------------------------
12 | news post 2 | 2014-02-14 21:09:45
--------------------------------------------
Here is an example of the CATEGORIES table
--------------------------------------------
id | post_ID | category_ID
--------------------------------------------
1 | 10 | 5
--------------------------------------------
2 | 12 | 5
--------------------------------------------