Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
neo302
Starting Member
30 Posts |
Posted - 2007-09-28 : 15:10:21
|
From a query?Sample data:ID c1 c2 c3 c41 a b d Can I create a result set of: Column1 Column2 c1 a c2 b c4 d Notice how c3 is not shown. Thanks!!! |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-09-28 : 15:31:36
|
select 'c1' as Column1, c1 as Column2from tbl where c1 is not nullunion allselect 'c2', c2from tbl where c2 is not nullunion allselect 'c3', c3from tbl where c3 is not nullunion allselect 'c4', c4from tbl where c4 is not null- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
neo302
Starting Member
30 Posts |
Posted - 2007-09-28 : 15:42:36
|
quote: Originally posted by jsmith8858 select 'c1' as Column1, c1 as Column2from tbl where c1 is not nullunion allselect 'c2', c2from tbl where c2 is not nullunion allselect 'c3', c3from tbl where c3 is not nullunion allselect 'c4', c4from tbl where c4 is not null- Jeffhttp://weblogs.sqlteam.com/JeffS
NIIIIIIIIICCCCCCE. Thanks Jeff!!! |
|
|
|
|
|