Re: UPDATE Syntax Check - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: UPDATE Syntax Check
Date
Msg-id jr8fc5$q6n$1@dough.gmane.org
Whole thread Raw
In response to UPDATE Syntax Check  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: UPDATE Syntax Check  (Rich Shepard <rshepard@appl-ecosys.com>)
Re: UPDATE Syntax Check  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
Rich Shepard wrote on 13.06.2012 00:17:
>    One table, waterchem, with primary key 'site' has columns easting and
> northing with no values in them. A second table, sites, with primary key
> 'name' has values for easting and northing for each row. I want to update
> waterchem with the easting and northing values from sites. My proposed
> statement is,
>
>    UPDATE waterchem
>    SET waterchem.easting, waterchem.northing = sites.easting, sites.northing
>    FROM sites AS s
>    WHERE waterchem.site = s.name;
>
>    Is this correct? If not, what approach should I adopt?
>

No it's not quite correct:

UPDATE waterchem
   SET waterchem.easting = s.easting
       waterchem.northing = s.northing
FROM sites AS s
WHERE waterchem.site = s.name;




pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: UPDATE Syntax Check
Next
From: Rich Shepard
Date:
Subject: Re: UPDATE Syntax Check