SELECT列表不在GROUP BY子句中,并且包含非聚集列....与sql_mode = only_full_group_by不兼容 [英] SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by
问题描述
AM在我的Windows PC上使用MySQL 5.7.13与WAMP服务器这里我的问题是在执行此查询时
SELECT *
FROM`tbl_customer_pod_uploads`
WHERE`load_id` ='78'AND
`status` ='Active'
GROUP BY`proof_type`
总是会出现这样的错误
SELECT列表的表达式#1不在GROUP BY子句中,并且包含非聚集列'returntr_prod.tbl_customer_pod_uploads.id',它在功能上不依赖于GROUP BY子句中的列;这是不符合sql_mode = only_full_group_by
你可以告诉我最好的解决方案...
我需要像
+ ---- + --------- + --------- --------- + ---------- + ----------- + ------- + ----- + --------------- + -------------- + ------------ + -------- + --------------------- + ------------------- - +
| id | user_id | load_id | bill_id |纬度| langitude | proof_type | document_type | file_name | is_private |状态| createdon | updatedon |
+ ---- + --------- + --------- + --------- + ---------- + ----------- ------------ + -------- + -------- + ------ + ------------ + -------- + --------------------- + --------------------- +
| 1 | 1 | 78 | 1 | 21.1212 | 21.5454 | 1 | 1 | id_Card.docx | 0 |活动| 2017-01-27 11:30:11 | 2017-01-27 11:30:14 |
+ ---- + --------- + --------- + --------- + ---------- + ----------- ------------ + -------- + -------- + ------ + ------------ + -------- + --------------------- + --------------------- +
SELECT列表的表达式#1不在GROUP BY子句中,并且包含nonaggregated列'returntr_prod.tbl_customer_pod_uploads.id',它在功能上不依赖于GROUP BY子句中的列;这与sql_mode = only_full_group_by不兼容
将通过此命令更改MySQL中的sql模式来解决,
SET GLOBAL sql_mode =(SELECT REPLACE(@@ sql_mode,'ONLY_FULL_GROUP_BY',''));
这也是我的工作原理..
我在项目中使用了这个becz,像这样的查询,只需更改此sql模式onli_full_group_by
ThanQ ...: - )
AM using MySQL 5.7.13 on my windows PC with WAMP Server
Here my Problem is While executing this query
SELECT *
FROM `tbl_customer_pod_uploads`
WHERE `load_id` = '78' AND
`status` = 'Active'
GROUP BY `proof_type`
Am getting always error like this
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'returntr_prod.tbl_customer_pod_uploads.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Can you please tell me the best solution...
I need Result like
+----+---------+---------+---------+----------+-----------+------------+---------------+--------------+------------+--------+---------------------+---------------------+
| id | user_id | load_id | bill_id | latitude | langitude | proof_type | document_type | file_name | is_private | status | createdon | updatedon |
+----+---------+---------+---------+----------+-----------+------------+---------------+--------------+------------+--------+---------------------+---------------------+
| 1 | 1 | 78 | 1 | 21.1212 | 21.5454 | 1 | 1 | id_Card.docx | 0 | Active | 2017-01-27 11:30:11 | 2017-01-27 11:30:14 |
+----+---------+---------+---------+----------+-----------+------------+---------------+--------------+------------+--------+---------------------+---------------------+
This
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'returntr_prod.tbl_customer_pod_uploads.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
will be simply solved by changing the sql mode in MySQL by this command,
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
This is too works me.. I used this becz in my project there are many Queries like this so just change this sql mode onli_full_group_by
ThanQ... :-)
这篇关于SELECT列表不在GROUP BY子句中,并且包含非聚集列....与sql_mode = only_full_group_by不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!