select * from ABC where [name]='高' 这个 SQL语句单独执行可以执行。但是我想把它放到另一个SQL语句的 and后面执行,比如把它写成 select * from tina where [name]='123' and (select * from list where [name]='高') 为什么就执行不了了呢,显示 :
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。
请问这是为什么?
...全文
19711打赏收藏
求教高手一个SQL语句
select * from ABC where [name]='高' 这个 SQL语句单独执行可以执行。但是我想把它放到另一个SQL语句的 and后面执行,比如把它写成 select * from tina where [name]='123' and (select * from list where [name]='高') 为什么就执行不了了呢,显示 : 当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。 请问这是为什么?
--如果把(select * from list where [name]='高')作为条件
select * from tina where [name]='123'
and exists(select * from list where [name]='高')
--如果把(select * from list where [name]='高')作为数据集与(select * from tina where [name]='123' )合并
select * from tina where [name]='123'
union all
select * from list where [name]='高'