就是来自查询的结果,储存在数据库一个列中的文本。
SELECT * FROM TABLE1 +(select col2 from TABLE2)其中select col2 from TABLE2 的结果是where col1 =xx
怎么转换才能得到
SELECT * FROM TABLE1 where col1 =xx
SELECT * FROM TABLE1 +(select col2 from TABLE2)其中select col2 from TABLE2 的结果是where col1 =xx
怎么转换才能得到
SELECT * FROM TABLE1 where col1 =xx
declare @var varchar(8000),@id int,@cnt int
select @cnt=count(1) from table2
set @id=1
while @cnt>0
begin
select @var=col2 from table2 where id=@id
if @var is not null
begin
exec('select * from table1 '+@var)
set @cnt=@cnt-1
end
set @id=@id+1
end
SELECT * FROM TABLE1 +(select col2 from TABLE2)
得到
SELECT * FROM TABLE1 where col1 =xx
怎么才能转换?