Not in for two columns with Inner join
-
Hi All, I want to use Non in on two columns like for example I am importing Prod Cost from some history table of xml imports (example Orders table). For that what am I doing is, taking the values from Orders table in to Temporary table which have to be imported. Then I am planning to import the values from this Temp table into our ProdCost table, which do not exist for in ProdCost table for the year as well. Like I want to use Select * from #Temp Where (year, ProdId) not in (Select Year, ProdId from ProdCost). Is there any way to do this in SQL Server?
Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA
-
Hi All, I want to use Non in on two columns like for example I am importing Prod Cost from some history table of xml imports (example Orders table). For that what am I doing is, taking the values from Orders table in to Temporary table which have to be imported. Then I am planning to import the values from this Temp table into our ProdCost table, which do not exist for in ProdCost table for the year as well. Like I want to use Select * from #Temp Where (year, ProdId) not in (Select Year, ProdId from ProdCost). Is there any way to do this in SQL Server?
Thanks & Regards, Abdul Aleem Mohammad St Louis MO - USA
Try this where clause. Where not exists (Select * from ProdCost where Year = #Temp.Year and ProdID = #Temp.ProdID)
Never underestimate the power of human stupidity RAH