如果 a 和 b 结构一样 select a from tablename where b=1 union(unionall)select b from tablename where b=2;
如果结构不一样,但两者有关联的 column
select a.a , b.b from t1 a,t2 b where a.a=1 and b.b=2 and a.x=b.x;
如果结构不一样,且无关联的 column
那我就没招了
declare @sql varchar(8000)
set @sql=''
select @sql=@sql+','+a from tableName where b in (1,2,3)
set @sql=stuff(@sql,1,1,'')
select @sql
select a from tablename where b=1
union
select b from tablename where b=2