本文介绍了SELECT列表不在GROUP BY子句中,并且包含非聚集列....与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`

总是会出现这样的错误

你可以告诉我最好的解决方案...

我需要像

  + ---- + --------- + --------- --------- + ---------- + ----------- + ------- + ----- + --------------- + -------------- + ------------ + -------- + --------------------- + ------------------- -  + 
| 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 |
+ ---- + --------- + --------- + --------- + ---------- + ----------- ------------ + -------- + -------- + ------ + ------------ + -------- + --------------------- + --------------------- +




将通过此命令更改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

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

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不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 03:39