• Register
0 votes
34 views

Problem :

I am currently using MySQL 5.7.13 on my windows PC with the WAMP Server

I am facing following error while executing below the query.

Error:

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

Does anybody have any solution for above error?

6 5 3
7,540 points

1 Answer

0 votes

Solution :

If the MySQL's only_full_group_by mode is turned on it will mean that the strict ANSI SQL rules will be applicable while using GROUP BY clause. With respect to the query, it suggests that if the GROUP BY of the proof_type column used, then you can only select two things:

·    your proof_type column, or

·     the aggregates of any other column


The "aggregates" of any other columns means use of the aggregate function e.g. MIN(), MAX(), or AVG() with another column.

In the majority of MySQL GROUP BY questions which come to me so I have strict mode turned off and so the query is running with incorrect results. But in your case the query will not run at all that’s why you are thinking about what you actually want to do.

9 7 4
38,600 points

Related questions

0 votes
1 answer 26 views
26 views
Problem : Currently I am using the MySQL 5.7.13 on the windows PC with the WAMP Server While executing below query I am facing following error SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id` = '78' AND `status` = ' ... 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
asked Feb 18 mphil 2.3k points
0 votes
1 answer 67 views
67 views
Problem : I want to select a maximum avg for each cname in my table. SELECT cname, wmname, MAX(avg)  FROM makerar GROUP BY cname; But I will get the below error, ERROR:  column "makerar.wmname" must appear in the GROUP BY clause or be used in an   aggregate ... )  FROM makerar GROUP BY cname; How can I go about fixing above error? Note: This table is the VIEW created from the previous operation.
asked Jan 22 jwilliam 3.9k points
–1 vote
1 answer 55 views
55 views
Problem : I want to display the column B in my below mentioned SQL query, but when I try to add it to my query it gives me following error: Column T2.M' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. My code: SELECT L, COUNT(M) as T1, M FROM T2 WHERE ID=1 GROUP BY L
asked Nov 27, 2019 alecxe 7.5k points
0 votes
2 answers 89 views
89 views
Problem : I am new to the SQL. What am I doing wrong here? SELECT LEFT(SUBSTRING(batchinfo.datapath, PATINDEX('%[0-9][0-9][0-9]%', batchinfo.datapath), 8000), PATINDEX('%[^0-9]%', SUBSTRING(batchinfo.datapath, PATINDEX('%[0-9][0-9][0-9]%',batchinfo. ... I am trying to do group by the first, second, and third columns having the max rid. It is works perfectly fine without the group by and having.
asked Nov 27, 2019 alecxe 7.5k points