-
Table1
acct date
==================
111 01-jan-01
112 08-feb-00
113 18-mar-01
114 17-jun-00
115 21-jul-00
116 30-apr-00
Table2
acct status date1
=====================
111 open ?
112 cls ?
113 tbd ?
114 tbd ?
115 cls ?
116 open ?
Can someone please help me write a sql query to do the following:
I need to copy the values of table1, date column to table2, date1 column. The two tables can be linked by column acct. Both tables have
many other columns that are not listed here.
Thanks for your help.
-
Are you trying to insert date from table1 to table2(date1)?
If yes, then
insert into table table2
(date1)
select a.date from table1 a , table2 b where
a.acct =b.acct ;
-
Maybe this will help you out:
declare
cursor c_t1
is
select * from table1;
begin
for vc_t1 in c_t1
loop
update table2
set date1 = vc_t1.date
where acct = vc_t1.acct;
end loop;
commit;
end;
/
Regards
Ben de Boer
-
just corrected
insert into table2
(date1)
select a.date from table1 a , table2 b where
a.acct =b.acct ;
-
Thank you very much for all your help !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|