Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Updating one table with the data from another table with matching field

Re: Updating one table with the data from another table with matching field

From: Anon <pjbump_at_i1.net>
Date: 1997/09/20
Message-ID: <01bcc5e7$eb771b20$d33ae6cf@default>#1/1

UPDATE Master_Table A
SET A.Salary =
(SELECT Avg_Salary/12

    FROM Payroll_Table B
  WHERE B.Ssn = A.Ssn);

-- 
Phillip Bump
Senior Principal Consultant
Oracle Consulting
----------------------------------------------------------------------------
-----------------------------------------------------------------------
The opinions expressed are my own and do not necessarily reflect those of
Oracle Corporation

SKMGMT <skmgmt_at_aol.com> wrote in article
<19970917015900.VAA19564_at_ladder01.news.aol.com>...

> Kindly help with the following problem:
> If there is a master table with employee info and another table called
> payroll consisting of 2 fields social.sec.num and salary.
> Master_Table: Name Varchar2(20)
> Age Number(3)
> Salary Number (8)
> Ssn Number (10)
>
> Payroll_Table Ssn Number (10)
> Avg_Salary Number (8)
>
> Update the salary column of master table with avg_salary/12 for
> corresponding ssn. Use only SQL query. PL/SQL Block not allowed.
>
Received on Sat Sep 20 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US