我試圖執行這個查詢:嵌套在SQL錯誤操作數選擇應包含1列
select *, (select * from tab1 where tab1.type!="firstype") as P
from tab2 where tab2.attr="something" and tab2.tab1_id=P.id
但我有此錯誤:
Error Code: 1241. Operand should contain 1 column(s) 0,001 sec
我理解的錯誤,但不知其所以然出來。 P.id不工作?
不能使用子查詢產生的多個列的方式。嘗試只選擇ID字段。 – 11684 2014-11-05 14:58:28
(即「從tab1 ...中選擇ID」)。 – 11684 2014-11-05 14:59:07