Solved

sql server without using the operator EXCEPT

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Selecting specific rows 3 36
Row-Level Security 2 20
Log Backup 2 13
Usage Scenarios for Extended Events? 1 12
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

21 Experts available now in Live!

Get 1:1 Help Now