UPDATE Syntax Check

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: UPDATE Syntax Check
Date: 2012-06-12 22:17:37
Message-ID: alpine.LNX.2.00.1206121512480.5399@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

Rich

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2012-06-12 22:20:53 Re: UPDATE Syntax Check
Previous Message Yuriy Rusinov 2012-06-12 20:38:02 Reference with inheritance propagate data