当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。

我想大多数初学者遇到过这种问题,“当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。

 

 

select * from yhl where (ProviderCode+GoodsCode) in 
(select ProviderCode,GoodsCode from Goodsinfo where Property in (select Property from FilterTab where ClientName = 'D')) 

 

select * from yhl where (ProviderCode+GoodsCode) in
 (select ProviderCode,GoodsCode from Goodsinfo where Property in 
(select Property from FilterTab where ClientName = 'D'))

 


从错误的提示中我知道,因为我的子查询里面有两个字段,后来才知道,是可以把这些字段合并的。

也就是说将两个字段合并为一个字段 !问题可以解决!

 

select * from yhl where (ProviderCode+GoodsCode) in
 (select ProviderCode+GoodsCode from Goodsinfo where Property in 
(select Property from FilterTab where ClientName = 'D'))

 

 

 

posted @ 2010-07-13 09:46  莫问哥哥  阅读(17388)  评论(0)    收藏  举报