1

We have two MySQL Database system.

  1. with Version 5.7.32
  2. With Version 5.7.35

Below query is executing on Server #1 but not on Server #2, however it was running fine on both till yesterday.

Query being used :

select A, 
       B, 
       SUM(C)
from TableX
group by A;

Now from today onwards, we had to change the query as below to run on Server #2 :

select A, 
       B, 
       SUM(C)
from TableX
group by A,B;

Please suggest.

Ergest Basha
  • 7,870
  • 4
  • 8
  • 28
adil khan
  • 21
  • 2
  • What have you changed _since yesterday_? Do you get any errors _or_ better describe "not running on Server #2"? Compare all parameters. – Justinas Dec 28 '21 at 09:17
  • 1
    Check `ONLY_FULL_GROUP_BY` SQL Mode - it is set on the server where the query fails (on Server #2). – Akina Dec 28 '21 at 09:18
  • *we had to change the query as below to run on Server #2* If `A` column is not set as UNIQUE (maybe primary key) then this query logic is not the same, and it will produce the output which differs from those of 1st query. – Akina Dec 28 '21 at 09:21
  • Nothing has changed from Yesterday. @Akina Thanks a lot !! Indeed the SQL_MODE was set to ONLY_FULL_GROUP_BY on server #2, what we don't understand is how it became active on its own, till yesterday, same query was running fine on both server. – adil khan Dec 28 '21 at 10:35

0 Answers0