29.5.09

update with Inner join in SQL Server

Update Statement with join between two tables :

I got a chance to join two different tables and update one or more tables involved in join.

Oops, this syntax is not working in Oracle. I have tried it in my PL/SQL window. Strange :-(

-- Am creating new tables

create table aa1(id int,name char(10))
create table aa(id int,name char(10))

-- Am inserting my records in the table
insert into aa values(1,'venkat')
insert into aa1 values(1,'venkat1')

-- Selecting records from the table

select * from aa
select * from aa1

-- Query to update the table with join operator
update aa set aa.id=2
from aa inner join aa1 on aa.id=aa1.id

But, this query won't work in Oracle... hats off SQL Server. You are really great...

Happy learning!!!

Thanks and Regards,
Venkatesan Prabu .J

No comments:

Post a Comment