我尝试执行此查询:
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 不起作用?
最佳答案
将您的查询更改为:-
SELECT *
FROM Tab1 P, Tab2
WHERE tab2.tab1_id=P.id
AND tab2.attr = "something"
AND tab1.type != "firstype"
关于mysql - sql 错误操作数应包含 1 列中的嵌套选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26760161/