 |
 |
Archives of the TeradataForum
Message Posted: Tue, 19 Feb 2008 @ 12:02:10 GMT
Subj: | | Re: SQL to populate additional data |
|
From: | | narayan.murthy |
sel * from t1;
a b
----------- -----------
1 2 <------- we want to expand this row
2 3
ins into t1
sel c1,c2 from
(sel a, csum(1,1) from t1,(sel * from sometable sample 10) temp1
where a =1) derv(c1,c2),t1
where c1 = a and c2 > b;
Note: "sometable" is some table which contains a some rows which could be 10,100, 1000.... depending on how many rows you want to auto-
generate.
The definition of such a table could be something like :
Ct sometable(a int);
Ins into sometable(1);
.repeat 1000
Ins into sometable select a+1 from sometable;
| |