Try:

update zip set city_id = ( select city_id 
                                        from city 
                                     where name = zip.city);

HTH
Ken

P Kishor <[EMAIL PROTECTED]> wrote: CREATE TABLE zip (zip_code, city);
CREATE TABLE city (city_id, name);

INSERT a bunch of data. Then...

ALTER TABLE zip ADD COLUMN city_id;

UPDATE zip
SET city_id = c.city_id
FROM zip JOIN city c ON zip.city = c.name;

SQL error: near "from": syntax error

hints please!

-- 
Puneet Kishor

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



P Kishor <[EMAIL PROTECTED]> wrote: CREATE TABLE zip (zip_code, city);
CREATE TABLE city (city_id, name);

INSERT a bunch of data. Then...

ALTER TABLE zip ADD COLUMN city_id;

UPDATE zip
SET city_id = c.city_id
FROM zip JOIN city c ON zip.city = c.name;

SQL error: near "from": syntax error

hints please!

-- 
Puneet Kishor

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to