Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Not in for two columns with Inner join

Not in for two columns with Inner join

Scheduled Pinned Locked Moved Database
databasesql-serversysadminxmltutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • I indian143

      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

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups