Operand should contain 1 column(s)可能有很多原因,记录一下自己碰到的情况
- where子查询中select目标太多
直接上例子
错误:
SELECT
student.sId ,student.sName
FROM
student
WHERE student.sId
NOT IN (SELECT sc.sId , count(sc.sId) AS count_sid FROM sc GROUP BY sc.sId HAVING count_sid =3)
正确
SELECT
student.sId ,student.sName
FROM
student
WHERE student.sId
NOT IN (SELECT sc.sId FROM sc GROUP BY sc.sId HAVING count(sc.sId) =3)