sql_mode=only_full_group_by

sql_mode=only_full_group_by  对于select 后面的列必须出现在group by后面,或者select后面的列出现在where 条件里面并且是画等号,或者出现在聚合函数里面

 

mysql> select name from aaa where id < 3 group by name,id;
+-------------+
| name |
+-------------+
| chenxiaofei |
| heixiong |
+-------------+
2 rows in set (0.00 sec)

mysql> select name,id from aaa where id < 3 group by name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'domino_fids.aaa.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> select name,id from aaa where id < 3 group by name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'domino_fids.aaa.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> select name from aaa where id < 3 group by name,id;
+-------------+
| name |
+-------------+
| chenxiaofei |
| heixiong |
+-------------+
2 rows in set (0.00 sec)

mysql> select name from aaa where id < 3 group by name;
+-------------+
| name |
+-------------+
| chenxiaofei |
| heixiong |
+-------------+
2 rows in set (0.00 sec)

mysql> select sum(id) from aaa;
+---------+
| sum(id) |
+---------+
| 6 |
+---------+
1 row in set (0.00 sec)

mysql> select name from aaa where id < 3 group by name;
+-------------+
| name |
+-------------+
| chenxiaofei |
| heixiong |
+-------------+
2 rows in set (0.00 sec)

mysql> select sum(id),name from aaa where id < 3 group by name;
+---------+-------------+
| sum(id) | name |
+---------+-------------+
| 1 | chenxiaofei |
| 2 | heixiong |
+---------+-------------+
2 rows in set (0.00 sec)

mysql> select name,id from aaa where id < 3 group by name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'domino_fids.aaa.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql> select name,id from aaa where id = 3 group by name;
+----------+------+
| name | id |
+----------+------+
| diandian | 3 |
+----------+------+
1 row in set (0.00 sec)

mysql> select name,id from aaa where id < 2 group by name;
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'domino_fids.aaa.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

上一篇:fiddler过滤域名:仅显示指定的域名


下一篇:BurpSuite filter介绍