I have coded this so many ways I am now confused: here is what I would like to do but I cannot get the code to work:
Tables:
Tab1:
group_key
date
amount
agy
fy
Tab2:
group_key
description
address
fy - blank
agy - blank
I want the fy and agy from tab1 to be populated in tab 2 matching on Group_key from both tables. Below is the code I have tried and the errors I am receiving I hope you can help.
first try:
This prouduces a -811 error
I have also tried the following:
I receive error -104 illegal symbol t
I have also tried the following
and I receive the error stating from is an illegal keyword for the update clause.
I have tried several iteration for all of the above but I can not get it to work, I can write a cobol program to make it work but through my logic one of the above options should work with a little tweaking. I hope some one can help me!
Thanks in advance for your time!!!
Greg Walker
Tables:
Tab1:
group_key
date
amount
agy
fy
Tab2:
group_key
description
address
fy - blank
agy - blank
I want the fy and agy from tab1 to be populated in tab 2 matching on Group_key from both tables. Below is the code I have tried and the errors I am receiving I hope you can help.
first try:
Code:
update table2 c set c.fy = (Select a.fy from tab1 a, tab2 b, where a.group_key = b.group_key)
I have also tried the following:
Code:
update tab2 c set c.fy = t.fy where (select a.fy from tab1 a, tab2 b where a.group_key = b.group_key) t
I have also tried the following
Code:
update tab2 c set c.fy = t.fy from (select a.fy from tab1 a, tab2 b where a.group_key = b.group_key) t where c.group_key = t.grup_key
I have tried several iteration for all of the above but I can not get it to work, I can write a cobol program to make it work but through my logic one of the above options should work with a little tweaking. I hope some one can help me!
Thanks in advance for your time!!!
Greg Walker
Comment