|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 5/24/2008 11:15:50 AM
Posts: 1,
Visits: 5
|
|
Hi all,
I need to create two records out of one, conditionally.
The situation is, i have a single record which contains a date field. I need to create another one with same values for all the fields except this date field. I know how to populate/manipulate the date field but dont know how to create two out of one records.
Please help....
Shuabh
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: Today @ 3:33:46 PM
Posts: 24,
Visits: 81
|
|
I may have got the wrong end of the stick but this works!
Good luck.
/* CREATE TEMP TABLE */
create multiset volatile table RT_TEST
(
colA byteint not null
,colB date format 'yyyymmdd' not null
,colC byteint not null
) primary index (colA)
on commit preserve rows;
/* INSERT TEST DATA */
insert into RT_TEST ( 1, 1080528, 10 );
insert into RT_TEST ( 2, 1080529, 20 );
insert into RT_TEST ( 3, 1080530, 30 );
/* SHOW DATA */
sel * from rt_test;
/* - SQL ABOVE RETURNS -
colA colB colC
1 28/05/2008 10
2 29/05/2008 20
3 30/05/2008 30
*/
/* CONDITIONAL INSERT */
INSERT INTO RT_TEST
SELECT
colA
,1081231
,colC
FROM RT_TEST
WHERE colB = 1080529;
/* SHOW DATA */
sel * from RT_TEST;
/* - SQL ABOVE RETURNS -
colA colB colC
1 28/05/2008 10
2 29/05/2008 20
2 31/12/2008 20
3 30/05/2008 30
*/
|
|
|
|