# CntlPanel6 Analysis generated on: 4/2/2025 9:58:03 AM --- ## SQL Statement ```sql SELECT Process.PartNumber FROM ((CntlPanel LEFT JOIN CntlPanel4 ON CntlPanel.PRDNO = CntlPanel4.pn) LEFT JOIN Process ON CntlPanel4.Process.PartNumber = Process.PartNumber) LEFT JOIN MachinesQ1 ON Process.PartNumber = MachinesQ1.PartNumber WHERE (((MachinesQ1.Prime)=Yes)); ``` ## Dependencies - [[Queries/CntlPanel4]] - [[Tables/Process]] - [[Queries/MachinesQ1]] ## Parameters - *None* ## What it does **SQL Query Description** ========================== This SQL query retrieves a list of Part Numbers from the `Process` table, filtered by a condition related to prime status on machines. ### Query Breakdown The query consists of three joins and a conditional filter: #### Join 1: CntlPanel and CntlPanel4 ```sql CntlPanel LEFT JOIN CntlPanel4 ON CntlPanel.PRDNO = CntlPanel4.pn ``` This join combines the `CntlPanel` table with itself, based on the `PRDNO` column in both tables. The `LEFT JOIN` ensures that all records from `CntlPanel` are included, even if there is no matching record in `CntlPanel4`. #### Join 2: Process and CntlPanel4 ```sql LEFT JOIN Process ON CntlPanel4.Process.PartNumber = Process.PartNumber ``` This join links the results of the first join with the `Process` table, based on the `PartNumber` column. The `LEFT JOIN` again ensures that all records from `CntlPanel4` are included. #### Join 3: MachinesQ1 and Process ```sql LEFT JOIN MachinesQ1 ON Process.PartNumber = MachinesQ1.PartNumber ``` This final join combines the results of the previous two joins with the `MachinesQ1` table, based on the `PartNumber` column. The `LEFT JOIN` preserves all records from the earlier joins. #### Filter: Prime Status ```sql WHERE (((MachinesQ1.Prime)=Yes)); ``` This filter condition checks for machines where the `Prime` status is `Yes`. Only rows that meet this condition are included in the final result set. ### Result The query returns a list of Part Numbers from the `Process` table, filtered by the presence of prime status on machines. The result set includes all records from the original `CntlPanel` and `CntlPanel4` tables, linked to the filtered results from the `MachinesQ1` table. ### Example Output Assuming a sample database: | CntlPanel | CntlPanel4 | Process | MachinesQ1 | | --- | --- | --- | --- | | A123 | A123_1 | X123 | Yes | | B456 | B456_2 | Y789 | No | | ... | ... | ... | ... | The query would return: * Part Numbers from the `Process` table with prime status on machines: + X123 + ... (other part numbers with prime status)