我有一個名爲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 ...查詢將忽略它 –