Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle sql

Status
Not open for further replies.

hugheskbh

Programmer
Dec 18, 2002
37
0
0
US
How can I update a column with the values of a different column in sql. I'm trying to populate a column with the values of a separate column.

Thanks
 
Update my_table set First_column = Second_column where Some_Condition = 'TRUE'

if the second column is in the same table

Update First_table set First_column = (select second_column from Second_table where First_table.master_key = Second_table.master_key)

is an example where the second column is in a different table

I tried to remain child-like, all I acheived was childish.
 
I actual fact, if the columns are in the same table there is no need for a WHERE clause, just
UPDATE TABLE
SET COL1 = COL2

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top