Re: update from another table

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "ivan" <IVANCCC(at)terra(dot)es>, pgsql-sql(at)postgresql(dot)org
Subject: Re: update from another table
Date: 2001-06-12 20:03:21
Message-ID: web-70963@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ivan,

> i would like to know how can i update a table with columns from
> another
> table and adding a new column with a secuence,

You cannot update a table and add a new column at with one statement.
Updating a table is Data Manipulation Language (DML) and adding a column
is Data Definition Language (DDL) and the two may not be combined.

For the update statement:

> update table
> set column = (select column from table2), ......, set
> column=secuence..
>
> is it right?????

Nope. Try

UPDATE table1 SET columnC = table2.columnB
FROM table2
WHERE table2.columnA = table1.columnA

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tim Barnard 2001-06-12 20:10:41 Re: Re: [SQL] maximum number of rows in table - what about oid limits?
Previous Message Roberto Mello 2001-06-12 19:48:14 Re: PL/PGSQL