dmanisit
asked on
SQL Query to Compare and then UPDATE
Hi, I am new to SQL, and would like some help please.
I am trying to compare 2 tables only 1 column in those tables. The tables are
1.) dbo.ImportPCMCost
2.) dbo.ImportIncludedList
The 2 tables are:
1.) dbo.ImportPCMCost.Procedur e_Code_ID
2.) dbo.ImportIncludedCost.ID
I want to match these 2 Colums and then I want to UPDATE the FEE Column that is located in dbo.ImportIncludedCost table. Please
I am trying to compare 2 tables only 1 column in those tables. The tables are
1.) dbo.ImportPCMCost
2.) dbo.ImportIncludedList
The 2 tables are:
1.) dbo.ImportPCMCost.Procedur
2.) dbo.ImportIncludedCost.ID
I want to match these 2 Colums and then I want to UPDATE the FEE Column that is located in dbo.ImportIncludedCost table. Please
try this,
update c
set c.fee = CASE WHEN c.ID=p.Procedure_Code_ID THEN '?' ELSE '?' END
from dbo.importincludedcost as c, dbo.importpcmcost as p
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So I have the Fee in the table ImportPCMCost named Fee that I want to take this Fee and update ImportIncludedList Table Field name Fee also
Then try the last statement posted.
ASKER
Thats awesome, thanks.
set fee =?
from dbo.importincludedcost as c
inner join dbo.importpcmcost as p
on c.id=p.procedure_code_id