Solved

sql server without using the operator EXCEPT

Posted on 2011-03-18
2
244 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now