pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL - update table problem...
2+ messages / 2 participants
[nested] [flat]

* SQL - update table problem...
@ 2006-11-13 10:36  Marko Rihtar <riki_fox@hotmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Marko Rihtar @ 2006-11-13 10:36 UTC (permalink / raw)
  To: pgsql-sql

Hi,

first i'm sorry if this message appears twice. first time didn't get through 
because i wasn't registered.

i'm trying to do update on multiple tables but don't know how.
is something like this posible with postgresql?

update table1
join table2 on (table1.id=table2.t1)
join table3 on (table2.id=table3.t2)
set table1.name='test', table2.sum=table1.x+table2.y, 
table3.cell='123456789'
where table1.id=6

i know that this syntax is not supported with postgres but i tried to 
rewrite the code using this synopsis:

UPDATE [ ONLY ] table SET column = { expression | DEFAULT } [, ...]
   [ FROM fromlist ]
   [ WHERE condition ]

i failed again.

thanks for help

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




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

* Re: SQL - update table problem...
@ 2006-11-15 06:50  Bruno Wolff III <bruno@wolff.to>
  parent: Marko Rihtar <riki_fox@hotmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2006-11-15 06:50 UTC (permalink / raw)
  To: Marko Rihtar <riki_fox@hotmail.com>; +Cc: pgsql-sql

On Mon, Nov 13, 2006 at 11:36:05 +0100,
  Marko Rihtar <riki_fox@hotmail.com> wrote:
> 
> i'm trying to do update on multiple tables but don't know how.
> is something like this posible with postgresql?

I believe you need to use multiple update statements to do this. Each
update can only update one table. You can join with other tables to
select which rows to update, but that doesn't let you update more than
one table at once.



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


end of thread, other threads:[~2006-11-15 06:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-13 10:36 SQL - update table problem... Marko Rihtar <riki_fox@hotmail.com>
2006-11-15 06:50 ` Bruno Wolff III <bruno@wolff.to>

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