[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

SQL not exsist statement

I need to find if a entry of one column that does not  exsists in another table. so I want a list of all the ItemClassComponents.itemID that are not in the Item.ID column.


0
DKJDA
Asked:
DKJDA
  • 3
  • 2
2 Solutions
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Try this

Select ItemClassComponents.itemID
from ItemClassComponents LEFT JOIN Item on ItemClassComponents.itemID = Item.ID
where Item.ID is null
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT ItemID
FROM ItemClassComponents
WHERE NOT EXISTS (SELECT 1 FROM Item WHERE Item.ID  =  ItemClassComponents.itemID   )
0
 
DKJDAAuthor Commented:
Thanks for the help both are correct.  Not sure if i should split the points or award to first responder. which is the proper etiquette?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Raja Jegan RSQL Server DBA & ArchitectCommented:
You can split it across two posts since there is no much time difference..
0
 
DKJDAAuthor Commented:
Aneeshattingal, thanks for your help ! Would you mind explaining what the "1" is in your solution?
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
If you use Exists, then either 1 or column name represents the same..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now