我想将SQL中的IN运算符与select语句一起使用,但得到了以下错误:“无法对包含聚合或子查询的表达式执行聚合函数”。
我使用的代码如下所示:
select * from Table where ID in (select Units from Table2)
发布于 2013-04-18 17:27:06
您使用了WHEN
而不是WHERE
SELECT * FROM `Table` WHERE `ID` IN (SELECT `Units` FROM `Table2`)
发布于 2013-04-18 17:28:12
在查询中,您应该使用where
代替when
。正确的查询将是:
select * from Table where ID in (select Units from Table2)
发布于 2013-04-18 17:31:17
您应该尝试在第二个查询中选择特定的ID列,如下所示:
Select*from Table where ID IN (Select ID from Table2)
https://stackoverflow.com/questions/16079178
复制相似问题