MYSQL upgrade GROUP BY clause; this is incompatible with sql_mode=only_full_group_by -


we have upgraded mysql database;

select l.subscriberid subscriberid email_list_subscribers l, email_queues q              q.recipient = l.subscriberid , q.queueid = 2343 , queuetype = 'send'              , l.listid in (31) group l.emailaddress having count(l.emailaddress) > 1 

and get

#1055 - expression #1 of select list not in group clause , contains nonaggregated column 'emailmarketer.l.subscriberid' not functionally dependent on columns in group clause; incompatible sql_mode=only_full_group_by 

what can do?

try this:

select l.emailaddress,        group_concat(l.subscriberid) subscriberids email_list_subscribers l join      email_queues  q       on q.recipient = l.subscriberid  q.queueid = 2343 , queuetype = 'send' ,       l.listid in (31) group l.emailaddress having count(l.emailaddress) > 1; 

notes:

  • never use commas in from clause. always use explicit, proper join syntax.
  • this returns list of subscribers each email.
  • if there duplicates, might want group_concat(distinct l.subscriberid).

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -