首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请教两个值的嵌套查询如何做

2012-01-18 
请问两个值的嵌套查询怎么做?select*fromtable1where(aa,bb)in(selectaa,bbfromtable1wherecc dd )如上的

请问两个值的嵌套查询怎么做?
select   *   from   table1   where
(aa,bb)   in   (select   aa,bb   from   table1   where   cc= 'dd ')
如上的一个查询,但是我写的不对,请帮我纠正一下

[解决办法]
select * from table1 a where exists(select 1 from table1 where aa=a.aa and bb=a.bb and cc = 'dd ')

热点排行