Re: Update Syntax Question
Posted in 1995
My thanks to everyone for their prompt answers to my problem. It turns out that Robert Minter and Lester Knutsen were right on the money with their answers to the syntax problem. I needed the extra set of ( ) around the select statement. Robert's version, which didn't even use the second where clause worked the fastest! Thanks again to all who responded. See you California. Tracy W. Nedd National Weather Service - DBA vball@skipper.ssmc.noaa.gov } } >From Tracy Nedd: } * My current version of the statement is: } * } * update d_cat } * set (code1, code2, code3, code4) = } * (select #c#ode1, code2, code3, code4 } * from u_cat } * where } * u_cat.state = d_cat.state and } * u_cat.county = d_cat.county ) } * } * where d_cat.state = u_cat.state and } * d_cat.county = u_cat.county } } Try the following: } } UPDATE d_cat } SET (code1,code2,code3,code4) = } ((SELECT code1,code2,code3,code4 FROM u_cat } WHERE u_cat.state = d_cat.state AND } u_cat.country = d_cat.country)); } } For some reason, you need a seperate set of parenthesis around the select } statement. Also, you do not need the second where clause if you want to } alter all records in the table. } } Robert Minter Data Systems Support \\\\\\_/// } Senior Software Engineer A Client Technologies Company ( _ _ ) } E-Mail: rob@dssmktg.com Tel: 714.771.0454 (| ^ |) } #include <disclaimer.h> Fax: 714.771.3028 \\`-'/ } De Colores - Emmaus OC-13 SURF'S UP \\_/ }