|
-
Oops, read your query wrong. My bad.
Try this:
SELECT
---PC.ProjectCode_Item_Code
FROM
---mwebProjectCode---PC---,
---(
---SELECT DISTINCT
------Work_Item_Code
---FROM
------mwebWork
---WHERE
---------Work_Entity_Type---=---3
---AND---Work_ID------------<> 2531
---AND---Work_Level---------=---6
---)------------------W
WHERE
---------W.Work_Item_Code---(+)=---PC.ProjectCode_Item_Code
---AND---W.Work_Item_Code---IS---NULL
ORDER BY
---PC.ProjectCode_Item_Code
I had to change the structure because of the <>.
The basic concept is that NOT IN and NOT EXISTS are generally rather painful to do. Better to do an outer join, which will put NULLS in all the columns for the W table when the PC has an entry that the W table does not (NOT IN), then restrict the result set to only those values (W.NonNullableColumn IS NULL). Usually, you will use the PK or the actual join field to do this.
HTH,
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|