我们升级了MYSQL
数据库;
SELECT l.subscriberid AS subscriberid FROM email_list_subscribers AS l, email_queues AS q
WHERE q.recipient = l.subscriberid AND q.queueid = 2343 AND queuetype = 'send'
AND l.listid IN (31) GROUP BY l.emailaddress HAVING COUNT(l.emailaddress) > 1
现在我们得到了
#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'emailmarketer.l.subscriberid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
我们能做什么?
答案 0 :(得分:1)
试试这个:
SELECT l.emailaddress,
GROUP_CONCAT(l.subscriberid) AS subscriberids
FROM email_list_subscribers l JOIN
email_queues q
ON q.recipient = l.subscriberid
WHERE q.queueid = 2343 AND queuetype = 'send' AND
l.listid IN (31)
GROUP BY l.emailaddress
HAVING COUNT(l.emailaddress) > 1;
注意:
FROM
子句中使用逗号。 始终使用明确,正确的JOIN
语法。GROUP_CONCAT(DISTINCT l.subscriberid)
。