求一条SQl语句,怎么把一个表的数据作取出作为字段在另一个表中取值
如题 
 select   DecNo   from   A    
 怎么把DecNo   的值作为字段在B表中取值呢,求一条语句,谢谢各位
------解决方案--------------------declare @a varchar(1000) 
 set @a= 'select  ' 
 select @a=@a+DecNo from A 
 select @a=left(@a,len(@a)-1) 
 exec(@a+ ' from B ')
------解决方案--------------------create table a(id int,DecNo varchar(10)) 
 insert a 
 select 1,  'A1 ' union all 
 select 2,  'B1 ' union all 
 select 3,  'C1 '    
 declare @a varchar(1000) 
 select @a= ' ' 
 select @a=@a+ ', '+DecNo from A 
 select @a=stuff(@a,1,1, ' ') 
 select  'select  '+@a+ ' from B ' 
 exec( 'select  '+@a+ ' from B ')