AnotherAlan
Technical User
Hi All,
I'm new to this forum and have a very rudimentary knowledge of SQL, i'm a Unix Admin by trade...
We have just taken on another application though which requires some sql skills above and beyond my "current" capability.
I need to insert fixed values into a table , based upon the record meeting certain condition(s) which are referenced from another field in a separate table.
i.e
Table A has fields sdi_code and cog_code, these are the fields which will have the values set.
Table A has a field called sdi_num, this is the common link between Table A and Table B.
Table B has fields called type_code and trad_code.
This is what I've tried after lots of reading and googling(without success);
Insert into Table A
set sdi_code = "yes",
cog_code = "gb"
where sdi_num in
(select sdi_num from Table B s
where s.type_code = "EUC" and s.trad_code = "DEP")
and b_code = "ron"
It should be changing multiple rows, but its not doing anything.
All help appreciated.
Thanks
I'm new to this forum and have a very rudimentary knowledge of SQL, i'm a Unix Admin by trade...
We have just taken on another application though which requires some sql skills above and beyond my "current" capability.
I need to insert fixed values into a table , based upon the record meeting certain condition(s) which are referenced from another field in a separate table.
i.e
Table A has fields sdi_code and cog_code, these are the fields which will have the values set.
Table A has a field called sdi_num, this is the common link between Table A and Table B.
Table B has fields called type_code and trad_code.
This is what I've tried after lots of reading and googling(without success);
Insert into Table A
set sdi_code = "yes",
cog_code = "gb"
where sdi_num in
(select sdi_num from Table B s
where s.type_code = "EUC" and s.trad_code = "DEP")
and b_code = "ron"
It should be changing multiple rows, but its not doing anything.
All help appreciated.
Thanks