下面的查詢:錯誤與GROUP BY語句
SELECT a.vendor_id, a.crew_type_id, count(a.vendor_id) as `totalVendor`
FROM tb_vendor_crew_type_details as a
WHERE a.market = 1
AND a.crew_available > 0
AND a.crew_type_id IN (161, 183, 220, 221, 227)
Group by a.vendor_id
Having totalVendor >= 5
拋出一個錯誤:
SELECT list is not in GROUP BY clause and contains nonaggregated
column 'scope_worker_dev.a.crew_type_id' which is not functionally
dependent on columns in GROUP BY clause; this is incompatible with
sql_mode=only_full_group_by 0.00037 sec
可能是什麼原因呢?我在查詢中犯了什麼錯誤?