表包含:
c1 c2 c3 c4 c5
da1 Null Null db1 dc1
da1 dx1 Null db1 dc1
da1 Null dy1 db1 Null
所有字段都是varchar
。
我需要一个查询,结果数据没有任何空值并且在一行中
“da1 dx1 dy1 db1 dc1
”
答案 0 :(得分:4)
select 'da1', 'dx1', 'dt1', 'db1', 'dc1' from thattable limit 1
应该完美地运作
答案 1 :(得分:3)
答案 2 :(得分:0)
试试这个。
select * from (select distinct c1, c2, c3, c4, c5 from mytable) as mytab where c1 is not null and c2 is not null and c3 is not null and c4 is not null and c5 is not null