pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Update with two tables??
2+ messages / 2 participants
[nested] [flat]

* Update with two tables??
@ 1999-06-16 18:35 Mark <mlundquist@bvsdps.com>
  1999-06-16 21:15 ` Re: [SQL] Update with two tables?? Fomichev Michael <fomichev@null.ru>
  0 siblings, 1 reply; 2+ messages in thread

From: Mark @ 1999-06-16 18:35 UTC (permalink / raw)
  To: pgsql-sql

I am trying to update table A with data from table B. I thought I could do
something like:

UPDATE A
SET A.name = B.name
WHERE A.id = B.id
FROM B

but alas, this does not work.

Anyone have an idea of how I can do this?

-Mark


-----------------------------------------------------------------
   Mark Lundquist
   mlundquist@bvsdps.com
-----------------------------------------------------------------





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] Update with two tables??
  1999-06-16 18:35 Update with two tables?? Mark <mlundquist@bvsdps.com>
@ 1999-06-16 21:15 ` Fomichev Michael <fomichev@null.ru>
  0 siblings, 0 replies; 2+ messages in thread

From: Fomichev Michael @ 1999-06-16 21:15 UTC (permalink / raw)
  To: Mark <mlundquist@bvsdps.com>; +Cc: pgsql-sql


On Wed, 16 Jun 1999, Mark wrote:

> I am trying to update table A with data from table B. I thought I could do
> something like:
> 
> UPDATE A
> SET A.name = B.name
> WHERE A.id = B.id
> FROM B
> 
> but alas, this does not work.
> 
> Anyone have an idea of how I can do this?

It works. But you don't need A.name:
 UPDATE A
 SET name = B.name
 FROM B
 WHERE A.id = B.id;


@------------------+-----------------------------------------------@
| Fomichev Mikhail | The Government of Kamchatka region.           |
| Vladimirovich    | The Labour and Social Development Department. |
|<fomichev@null.ru>|                                               |
@------------------+-----------------------------------------------@





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-06-16 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-16 18:35 Update with two tables?? Mark <mlundquist@bvsdps.com>
1999-06-16 21:15 ` Fomichev Michael <fomichev@null.ru>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox