我有一个名为monitor_links与下面的列表:GROUP BY是不相容的sql_mode = only_full_group_by”
此表用于从其他网站存储指向。我得到使用此查询这些链接:
SELECT title, url
FROM monitor_links
WHERE id_domain = 5
GROUP BY url
ORDER BY date_created asc
随着该查询返回我的标题和URL从存储链接(其中id_domain等于5)。但在我的情况下,可以存在相同的行url,并不返回相同的重复url我使用GROUP BY url
。 (如果存在多个具有相同URL和id_domain = 5的行,我的代码只返回其中一行)。
的问题是,我发现了以下错误:
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'shuri.monitor_links.title' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by'.
有人说,我可以尝试禁用only_full_group_by
,但我想解决我的查询,而不是沉默的警告。
如果有两个条目具有相同的'url',但具有不同的'title'值,会发生什么? –
[在MySql中执行查询时仅与\ _full \ _group \ _by相关的错误]的可能重复(https://stackoverflow.com/questions/34115174/error-related-to-only-full-group-by-when -executing-a-query-in-mysql) –
@AlexMcMillan Nothing ...查询将忽略它 –