Inventory Script to Select Parts With or Without Journal Entries

146031

Inventory Script to Select Parts With or Without Journal Entries

This script is to create a list of parts that either does or does not have journal entries listed for that part.  The Parts Query Builder is not able to get this list for the parts that do not have journal entries.

Overview

The script below has both ways to do the select.  Add '--' in front of NOT EXISTS and remove '--' in front of EXISTS, to change the select depending on which list is needed.

Script:

SELECT p.Part_Code,p.Description

FROM   IN_Part p

WHERE NOT EXISTS

         -- EXISTS

         (

         SELECT Part_Code

         FROM  IN_Journal j

         WHERE  p.Part_Id = j.Part_Id)

         AND p.part_id <> 1

ORDER BY p.Part_Code ASC

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.