Solved

sql server without using the operator EXCEPT

Posted on 2011-03-18
2
246 Views
Last Modified: 2012-05-11
hi experts, i have this query
SELECT ProductID
FROM Production.Product
      EXCEPT
SELECT ProductID
FROM Production.WorkOrder

how I can resolve this without using the operator EXCEPT
0
Comment
Question by:enrique_aeo
  • 2
2 Comments
 
LVL 51

Accepted Solution

by:
HainKurt earned 250 total points
ID: 35166325
try

SELECT p.ProductID
FROM Production.Product p left join Production.WorkOrder w on p.ProductID=w.ProductID
where w.ProductID is null

0
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 250 total points
ID: 35166343
or

select p_ProductID as ProductID
from (
  SELECT p.ProductID p_ProductID, w.ProductID w_ProductID
  FROM Production.Product p left join Production.WorkOrder w on p.ProductID=w.ProductID
  ) x
where w_ProductID is null

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question