I have more than 1 rows in a table that belong to same ID.
I want to select row where more columns contain data .
eg.
My data looks like this
select * from my_table where id=1
PK Id Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10
101 1 NULL NULL NULL XX NULL NULL NULL NULL NULL NULL
102 1 NULL NULL NULL XX YY NULL ZZ NULL NULL NULL
103 1 NULL AA NULL NULL NULL NULL NULL NULL NULL NULL
104 1 NULL NULL NULL NULL NULL BB NULL NULL NULL NULL
105 1 NULL NULL NULL NULL NULL NULL NULL CC NULL NULL
I want query which will give me Output like this for id=1 : –
PK Id Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10
102 1 NULL NULL NULL XX YY NULL ZZ NULL NULL NULL
Where pk is your primary key…
If you can’t specify your column names…