i have table T and want select only distinct columns (without correlation between fields)
F1 F2 F3
1 A AA
1 B BB
2 B CC
2 C DD
2 C EE
3 C EE
desired output
F1 F2 F3
1 A AA
2 B BB
3 C CC
null null DD
null null EE
i try
select T.F1, T1.F2 from
(select distinct F1, row_num() rn from T) T
left join (select distinct F2, row_num() rn from T) T1 on T.rn=T1.rn1
left join etc...
can it be simpler?
Aucun commentaire:
Enregistrer un commentaire