Is there an easier way of doing this besides loading the data into a DataTable
and using Rows.Count
or using a MySqlDataReader
and iterating through all the resulted rows?
SQL COUNT(), AVG() and SUM() FunctionsThe COUNT() function returns the number of rows that matches a specified criterion.
Just click the column header. The status bar, in the lower-right corner of your Excel window, will tell you the row count. Do the same thing to count columns, but this time click the row selector at the left end of the row. If you select an entire row or column, Excel counts just the cells that contain data.
if you cant change the query easily
SELECT COUNT(*) FROM (<your complete query here>)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With