Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>At a guess, I'd say that your query, at the "NOT IN" point (i.e. its subquery), will effectively <strong>not</strong> show any partnumber if it has been removed from <strong>any</strong> package. This is because that subquery is searching across all packages. You will need to modify it (somehow) so that it only considers rows that pertain to the package of interest.</p> <p>Look closely at that subquery. It places conditions on part numbers, change levels, and event types. But what constraints are there for packages? How is it supposed to determine what rows go with Package 1, and what rows go with Package 2?</p> <p>My guess is that rows from Package 1 and Package 2 are commingled together. Since it finds a row where "EvtLog.EventTypeSelected = 'pn REMOVED From Wrapper'" is <strong>True</strong> for at least one of these packages, the "NOT IN" makes it <strong>False</strong> no matter the package you really wanted to display in your event viewer.</p> <hr> <p>What Brandon S said above (about IN versus EXISTS), plus: You may need to use an alias; for example (making alias <strong>EvtLog</strong> for the sub-query):</p> <pre><code>"SELECT DISTINCT tblRevRelLog_Detail.PartNumber, tblRevRelLog_Detail.ChangeLevel FROM tblRevRelLog_Detail LEFT JOIN tblEventLog ON (tblEventLog.PartNumber = tblRevRelLog_Detail.PartNumber) AND (tblEventLog.PartNumberChgLvl = tblRevRelLog_Detail.ChangeLevel) WHERE NOT EXISTS (SELECT EvtLog.PartNumber, EvtLog.PartNumberChgLvl FROM tblEventLog EvtLog WHERE tblEventLog.PartNumber=EvtLog.PartNumber AND tblEventLog.PartNumberChgLvl=EvtLog.PartNumberChgLvl AND EvtLog.EventTypeSelected = 'pn REMOVED From Wrapper' AND EvtLog.PartNumber = tblRevRelLog_Detail.PartNumber AND EvtLog.PartNumberChgLvl = tblRevRelLog_Detail.ChangeLevel) AND tblEventLog.TrackingNumber = """ &amp; tempTrackingNumber &amp; """ AND tblEventLog.PartNumber = tblRevRelLog_Detail.PartNumber AND tblEventLog.PartNumberChgLvl = tblRevRelLog_Detail.ChangeLevel" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload