Count rows in MySQL along with the actual row contents
问题 Is there a way in MySQL to do a single SQL statement that returns the selected rows along with the count of the result rows? I can do this: SELECT COUNT(*) FROM BigTable WHERE firstname LIKE 'a%'; Which gives me a single result row with the count (37,781). I can get the actual row data like this: SELECT firstname FROM BigTable WHERE firstname LIKE 'a%'; which displays the actual 37,781 rows. But when I try to combine them, like this: SELECT firstname, COUNT(*) FROM BigTable WHERE firstname