PSLine2000Documentation/Queries/Filtered Parts RSTD 2.md

2.6 KiB

Filtered Parts RSTD 2

Analysis generated on: 4/2/2025 9:59:56 AM

SQL Statement

SELECT [Filtered Parts rstd].*, AddnlPROC.RunStd
FROM [Filtered Parts rstd] LEFT JOIN AddnlPROC ON ([Filtered Parts rstd].FOPC = AddnlPROC.WC4) AND ([Filtered Parts rstd].FWC3 = AddnlPROC.WC3) AND ([Filtered Parts rstd].FWC2 = AddnlPROC.WC2) AND ([Filtered Parts rstd].PN = AddnlPROC.PartNumber)
WHERE ((([Filtered Parts rstd].Crstd)<>Format([RunStd],"0.00000")))
ORDER BY [Filtered Parts rstd].USAGE DESC;

Dependencies

Parameters

  • None

What it does

SQL Query Description

Overview

This SQL query retrieves data from two tables, Filtered Parts rstd and AddnlPROC, based on specific conditions and joins them using a LEFT JOIN. The results are filtered to exclude rows where the standardized cost is equal to a specific formatted value.

Breakdown

1. SELECT Clause

SELECT [Filtered Parts rstd].*, AddnlPROC.RunStd
  • Selects all columns (*) from the Filtered Parts rstd table and the RunStd column from the AddnlPROC table.

2. JOIN Clause

FROM [Filtered Parts rstd] LEFT JOIN AddnlPROC ON (
    ([Filtered Parts rstd].FOPC = AddnlPROC.WC4) AND 
    ([Filtered Parts rstd].FWC3 = AddnlPROC.WC3) AND 
    ([Filtered Parts rstd].FWC2 = AddnlPROC.WC2) AND 
    ([Filtered Parts rstd].PN = AddnlPROC.PartNumber)
  • Performs a LEFT JOIN between the Filtered Parts rstd and AddnlPROC tables.
  • Joins on four columns:
    • FOPC from Filtered Parts rstd and WC4 from AddnlPROC.
    • FWC3 from Filtered Parts rstd and WC3 from AddnlPROC.
    • FWC2 from Filtered Parts rstd and WC2 from AddnlPROC.
    • PN (Part Number) from Filtered Parts rstd and PartNumber from AddnlPROC.

3. WHERE Clause

WHERE ((([Filtered Parts rstd].Crstd)\u003c\u003eFormat([RunStd],"0.00000")))
  • Filters out rows where the standardized cost (Crstd) in the Filtered Parts rstd table is equal to a formatted value that represents the same as the RunStd value from the AddnlPROC table.

4. ORDER BY Clause

ORDER BY [Filtered Parts rstd].USAGE DESC;
  • Orders the results by descending order based on the USAGE column in the Filtered Parts rstd table.

Example Use Case

This query is likely used to retrieve a list of parts with their corresponding standardized costs and additional processing information, excluding rows where the standardized cost matches a specific formatted value. The results can be sorted by usage in descending order to prioritize the most commonly used parts.