MySQL gets the total number of group statistics for a field that can be retrieved from within the group by, and the number of records grouped is not counted.
The sql_calc_found_rows of MySQL uses the number of rows that get the query to write in many paging programs:
The code is as follows
SELECT COUNT (*) from ' table ' WHERE ...;
Identify the total number of records that meet the criteria
The code is as follows
SELECT * from ' table ' WHERE ... limit m,n;
Query the data to be displayed by the page such that a statement can be changed to:
The code is as follows
SELECT sql_calc_found_rows * from ' table ' WHERE ... limit M, N;
SELECT found_rows ();
So it can be implemented with the Sql_calc_found_rows and found_rows () functions that are available with MySQL.
The code is as follows
SELECT sql_calc_found_rows t3.id, a,bunch,of,other,stuff from T1, T2, T3 where (associate, T1,t2,and, and each other) T3 Upby t3.id LIMIT 10,20select found_rows () as Count;
Use the above two statements to complete the total number of record rows that meet group by.
Also attached:
Simple use of GROUP by:
The code is as follows
' SELECT column_id,count (*) as Count from My_table Group by column_id ';