Re: updating records in table A from selected records in table B

From: Maximilian Tyrtania <lists(at)contactking(dot)de>
To: Robert Poor <rdpoor(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: updating records in table A from selected records in table B
Date: 2011-03-30 05:46:08
Message-ID: AEF55947-7C17-4F9B-9ECD-0D4B8F910A49@contactking.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> ... is there a way to update quantity and cost fields in incumbents
> with the matching records from candidates? It seems that UPDATE is
> designed only to update one record at a time...

Oh, no, it is certainly possible to do what you want here. The usual trick is:

UPDATE sometable set somefield=somevalue where id in (select id from somecomplicatedsubquery)

Maximilian Tyrtania Software-Entwicklung
Dessauer Str. 6-7
10969 Berlin
http://www.contactking.de

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message aaronenabs 2011-03-30 12:34:13 Re: pg_dumpall
Previous Message Brent Dombrowski 2011-03-30 04:18:19 Re: pg_dumpall