问题
Mysql5.7;window系统
sql语句:select DISTINCT(tr.id) from td, tr where td.id=tr.id and td.status=1 and td.type=2 and tr.status=0 group by td.id;
执行时报错:this is incompatible with sql_mode=only_full_group_by
解决
1、进入数据库
2、select @@sql_mode;
3、set sql_mode=‘STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION’;
4、select @@global.sql_mode;
5、set @@global.sql_mode=(select replace(@@global.sql_mode,‘ONLY_FULL_GROUP_BY’,’’));
*直接 set global.sql_mode=‘值’;会报错