我收到错误消息
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在 GROUP BY name HAVING COUNT(DISTINCT goodfor_when.name) = 1 附近使用正确的语法。
这是发生错误的查询的一部分
....
WHERE
( `city`.`name` = "London" ) AND
`goodfor_what`.`name` IN ("Beers","Wine","Food")
GROUP BY name
HAVING COUNT(DISTINCT `goodfor_what`.`name`) = 3 AND `goodfor_when`.`name` IN ('Daytime') GROUP BY name
HAVING COUNT(DISTINCT `goodfor_when`.`name`) = 1 ORDER BY `t`.`name`, `t`.`id`;
但如果删除线有效
HAVING COUNT(DISTINCT `goodfor_what`.`name`) = 3 AND `goodfor_when`.`name` IN ('Daytime') GROUP BY name