Skip site navigation (1) Skip section navigation (2)

Update from a table.

From: Andrew Bell <acbell(at)iastate(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: Update from a table.
Date: 2001-11-21 14:02:27
Message-ID: 5.1.0.14.2.20011121075700.00ac4a10@acbell.mail.iastate.edu (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,

I want to update one table from another table based on a criteria.  For 
instance:

            table1                           table2
employee | salary | netSalary         employee | deductions

I want to update table1.netSalary to be table1.salary - table2.deductions where
   table1.employee = table2.employee.

I don't see any way to do something like this with the syntax.  What am I 
missing, or what can be recommended?


-- Andrew Bell
acbell(at)iastate(dot)edu
        


Responses

pgsql-novice by date

Next:From: K├Ânig, FrankDate: 2001-11-21 14:15:22
Subject: upper and lower doesn't work with german umlaut?
Previous:From: Juan Jose Natera AbreuDate: 2001-11-20 20:02:58
Subject: Re: Info about DBI::Sybase.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group