我正在使用MySQL。這是我的架構(gòu):供應商(sid:整數(shù),sname:字符串,地址字符串)零件(pid:整數(shù),pname:字符串,color:字符串)目錄(sid:整數(shù),pid:整數(shù),成本:實數(shù))(主鍵以粗體顯示)我正在嘗試編寫查詢以選擇至少兩個供應商制造的所有零件:-- Find the pids of parts supplied by at least two different suppliers.SELECT c1.pid -- select the pidFROM Catalog AS c1 -- from the Catalog tableWHERE c1.pid IN ( -- where that pid is in the set: SELECT c2.pid -- of pids FROM Catalog AS c2 -- from catalog WHERE c2.pid = c1.pid AND COUNT(c2.sid) >= 2 -- where there are at least two corresponding sids);首先,我什至會以正確的方式這樣做嗎?其次,我得到這個錯誤:1111-無效使用組功能我究竟做錯了什么?
添加回答
舉報
0/150
提交
取消