This is a nifty piece of SQL for finding out exactly who entered the five hundredth comment on your blog, assuming you have a WordPress blog with five hundred comments on it.
SELECT *
FROM "WordPress comment table"
ORDER BY comment_date
LIMIT 500 , 1
Right now, I don’t have a 500th comment, but it’s getting close. Well within a hundred type of close. The comment count started on 20th November 2004 when I first moved to WordPress, and I think 500 comments is worth celebrating with a gift for the commenter. Who’s it going to be? (The gift will have to be decided after the comment arrives, since I doubt Mr Bristow would appreciate yarn if it happens to be him.)
For those that are interested in the specifics of the SQL statement … the LIMIT clause at the end says to return one row at offset 500 in the overall query result set.
LIMIT is a really useful MySQL piece of syntax that allows you to run a query then step through a page at a time (where the 1 is replaced with say, “20” and you up the offset on suubsequent pages) or in this case to find a particular post at a particular location.
Given recent posting, I think your 500th commentor stands a good chance of being a spam engine!
Nope, they get weeded out before they count. It’ll be a real person.