Home » SQL & PL/SQL » SQL & PL/SQL » Update table from same table
Update table from same table [message #187186] Fri, 11 August 2006 04:24 Go to next message
tansiakl
Messages: 3
Registered: July 2006
Junior Member
Hello all,

I have the following problem which need help.

I have a table with the following data.

City/Qty Qty1 Qty2 Qty3
New York 12 23 34
Washington 34 45 98
New Jersey 12 25 34

What i need is a update statement that copy Qty2 and update to Qty3 for each row as below:

City/Qty Qty1 Qty2 Qty3
New York 12 23 23
Washington 34 45 45
New Jersey 12 25 25

Is there a way to do it?

Thanks a million

Bernard
Re: Update table from same table [message #187187 is a reply to message #187186] Fri, 11 August 2006 04:27 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, based off the information provided,
UPDATE <tablename>
SET qty3 = qty2;


would seem to do the trick.

Previous Topic: HOWTO: Column name for a SELECT obtained from an inner SELECT.
Next Topic: Not null constraint inside CTAS stmt
Goto Forum:
  


Current Time: Mon Dec 05 21:22:39 CST 2016

Total time taken to generate the page: 0.10070 seconds