Reputation: 8836
I have a SQL query that displays comments on a blog based on date. I would like to ignore the first one and display all the rest, something I can't do correctly.
My code so far is :
SELECT DISTINCT comment_post_ID, comment_date_gmt, comment_content
FROM $wpdb->comments
WHERE comment_post_ID = {$thePostID}
ORDER BY comment_date_gmt ASC
LIMIT 5
Upvotes: 1
Views: 128
Reputation: 25564
SELECT DISTINCT comment_post_ID, comment_date_gmt, comment_content
FROM $wpdb->comments WHERE comment_post_ID = {$thePostID}
ORDER BY comment_date_gmt ASC
LIMIT 1, 5
ignore first LIMIT 1, how_many
Upvotes: 2
Reputation: 284806
Change your limit clause to:
LIMIT 1, 5
That means start at the 1th row (0-indexed), and return up to 5.
Upvotes: 7