有一table1表中有a,b,c,d 字段,只有一条记录,四字段的值有三种情况
1。分别为aa,aa,bb,bb
2.分别为aa,aa,bb,cc
3.分别为aa,bb,cc,dd
注意:表中只有一条记录
我要选出四字段中不重复的值,如下
1。情况选出对应的值为aa,bb
2。情况选出对应的值为aa,bb,cc
3。情况选出对应的值为aa,bb,cc,dd
请高手指教!谢谢!
select a from t
union
select b from t
union
select c from t
union
select d from t
select distinct a from (select a from table1
union
select b from table1
union
select c from table1
union
select d from table1
) t1
select a from table1
union
select b from table1
union
select c from table1
union
select d from table1