Hi!
We have an Address table with a total of nine different name and address fields.
Sometimes every field is filled, but mostly there are several empty columns (NULL).
Now I want to create a SQL-query with a result where I can "move" all fields upwards, so that every empty column appears at the end.
For example:
FIELD
Name1 - John
Name2 -
Name3 - Big Company
Name4 -
Name5 -
Adr1 -
Adr2 - Main street
Adr3 -
Adr4 - Box 55
I want:
AdrInfo1 - John
AdrInfo2 - Big Company
AdrInfo3 - Main street
AdrInfo4 - Box 55
AdrInfo5 -
AdrInfo6 -
AdrInfo7 -
AdrInfo8 -
AdrInfo9 -
Does anyone have a solution for that?
Maybe with a "select case"?
/Goran
We have an Address table with a total of nine different name and address fields.
Sometimes every field is filled, but mostly there are several empty columns (NULL).
Now I want to create a SQL-query with a result where I can "move" all fields upwards, so that every empty column appears at the end.
For example:
FIELD
Name1 - John
Name2 -
Name3 - Big Company
Name4 -
Name5 -
Adr1 -
Adr2 - Main street
Adr3 -
Adr4 - Box 55
I want:
AdrInfo1 - John
AdrInfo2 - Big Company
AdrInfo3 - Main street
AdrInfo4 - Box 55
AdrInfo5 -
AdrInfo6 -
AdrInfo7 -
AdrInfo8 -
AdrInfo9 -
Does anyone have a solution for that?
Maybe with a "select case"?
/Goran