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

Re: Update from a table.

From: "Mark G(dot) Franz" <mgfranz(at)pe(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>, "Andrew Bell" <acbell(at)iastate(dot)edu>
Subject: Re: Update from a table.
Date: 2001-11-23 15:12:56
Message-ID: 000701c17431$55383110$6a01a8c0@mgflaptop (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Last I checked, you cannot perform arithmetic functions inside a query.  I
suggest retrieving the values, do the math, then update.

----- Original Message -----
From: "Andrew Bell" <acbell(at)iastate(dot)edu>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: 21 November, 2001 6:02 AM
Subject: [NOVICE] Update from a table.

> 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
>    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
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?

In response to


pgsql-novice by date

Next:From: Tom LaneDate: 2001-11-23 16:43:43
Subject: Re: [HACKERS] upper and lower doesn't work with german umlaut?
Previous:From: Mo HolkarDate: 2001-11-23 09:39:23
Subject: Re: Creating users from shell or perl script

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