|
Archives of the TeradataForumMessage Posted: Tue, 16 Nov 2004 @ 20:34:36 GMT
<-- Anonymously Posted: Tuesday, November 16, 2004 15:28 --> Hi all, I am having the table like this. table: source_test columns: id1, id2, timeframe, amount Table has following records. id1 id2 timeframe amount 1 1 1 10 1 2 1 0 1 3 1 0 1 1 2 10 1 2 2 60 1 3 2 0 Now I want to insert the records into target table based on the timeframe target table structure would be like this. table: target_test columns: id1, id2, timeframe1, camount1, timeframe2, camount2 I want the output to be like this for time=1 id1 1 id2 1 timeframe1 1 camount1 10 timeframe2 2 camount2 20 I want the output to be like this for time=2 id1 1 id2 2 timeframe1 1 camount1 0 timeframe2 2 camount2 60 I want the output to be like this for time=3 id1 1 id2 3 timeframe1 0 camount1 0 timeframe2 3 camount2 0 What is the optimize way to write the select statment. Thanks
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||