1. for a common table, we can group a field. for example, for a table worker with three fields: username, age, salary, and male, we can select * fromworkergroupbyage ;, the group will be divided according to age. 2. if we select * floor (rand (0) * 2) xfromworkergroupbyx, the result will be divided into two groups, 1 and 3. if we want to count the number of people in each age group, we can select Tage, count (*) fromworkergr... mysqlsql injection database
1. for a common table, we can group a field, for example, three fields: username, age, salary, and mal e.
For a table worker, we can select * from worker group by age; then the group will be divided according to age.
2. if we selectFloor (rand (0) * 2) x from worker group by x results will also be divided into 0, 1 groups
3. to count the number of people in each age group, select age, count () From worker group by age;
4. if we want to know the result of rand (0) * 2 0 and 1, we selectLoor (rand (0) * 2) x, count () From worker group by x;
DuplicateEntry appears. after searching for a long time on the Internet, no results are returned.
However, an error occurs when mysql processes intermediate results internally.
I personally don't think the field is not unique. it's okay if it's not combined with count, I would like to ask you why an error occurs when you combine them (this may also cause the problem of SQL injection .)