|
Archives of the TeradataForumMessage Posted: Thu, 21 Sep 2006 @ 12:49:59 GMT
<-- Anonymously Posted: Thursday, September 21, 2006 06:33 --> I have a table as follows col1 col2 col3 ------------------------ 1 NULL 20 NULL 3 NULL NULL NULL 30 I want result as Result ------ 1 20 3 30 I can write query as select col1 FROM table1 WHERE col1 IS NOT NULL UNION ALL select col2 FROM table1 WHERE col2 IS NOT NULL UNION ALL select col3 FROM table1 WHERE Col3 IS NOT NULL Would like to know is there any better approach than this, with out needing to query the table again again. Note: Above is the much simplified version. The table which we are referring to has 50 columns and has millions of rows. Thanks in advance.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||