Help with Derived table | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Help with Derived table

I have 3 tables TableA , TableB and TableC I have to update tableA with the value of TableB by checking A.Field=B.Field
and TABLEB as condition that B.Field should exists in tableC Update A Set A.Field=B.Field From tableA A
(select B.Field From TableB B where B.Field=A.Field and B.Field in (select C.Field
From tableC C)) How to do it correctly.
Thanks in advance
Before running this make sure you have backup Update A
set field=B.field
from tableA A inner join tableB B on A.field=B.field
inner join tableC C on B.field=C.field
Madhivanan Failing to plan is Planning to fail
Hello Madhivanan
Thanks for your help. I have changed the structure of the Query and it seems to be working update A set A.Field=B.Field from TableA A
(select Field from tableB where Field in (select Field from tableC))
where A.Field=B.Field I will Try yours also and see how it works.
Could you tell me which query is efficient for it seems your one is more
well structured.? Thanks and Regards
Set the execution plan and see. I think mine is good Madhivanan Failing to plan is Planning to fail
It seems that you edited your question. Can you highlight it? Madhivanan Failing to plan is Planning to fail
I saw one spelling mistake in my question and so corrected that.
so that when somebody search for similar problem can easily find when search it.

Thats good anyway [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
]]>