From: | "Vangelis-Maria Tougia" <tougias(at)cytanet(dot)com(dot)cy> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | UPDATE table SET col = (SELECT ...) |
Date: | 2003-06-25 09:00:00 |
Message-ID: | LPBBJCOFLNPHLEKEIJJFKEMACCAA.tougias@cytanet.com.cy |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
I found follwing email sent to you in internet.
I am interested in same issue myself.
Did you finally found out any more information about how to Update a column
of a table by selecting value from another table?
Hello,
If I understand the SQL references I have read, UPDATEs are allowed to
pull data from SELECT statements, something like
UPDATE table SET col1 = (SELECT val1 FROM table WHERE id = 34),
SET col2 = (SELECT val2 FROM table WHERE id = 34)
WHERE id = 35;
However, the PostgreSQL parser chokes on the 'SELECT'. The
documentation says
UPDATE table SET column = expression [, ...]
[ FROM fromlist ]
[ WHERE condition ]
expression = A valid expression or value to assign to column.
I don't know exactly how to interpret `valid expression'.
--
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way down
From | Date | Subject | |
---|---|---|---|
Next Message | Dani Oderbolz | 2003-06-25 12:18:42 | Re: TR: Like and = |
Previous Message | Dani Oderbolz | 2003-06-25 08:16:35 | Re: Delete duplicates |