Andy Jarrett // Code. Develop. Create.

Multiple record counts in one MySql statement

I've been creating some reports recently and been needing a lot of count information. The below statement pulls multiple counts in one SQL statement. n.b. This is for MySQL and will probably be different for other db'sSELECT(SELECT count(*) FROM tblName) AS 'Total Records',(SELECT count(*) FROM tblName WHERE col = 'a') AS 'Count'

I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee. Your support keeps this site running and the coffee brewing! ☕️