PSLine2000Documentation/Queries/Query11.md

2.1 KiB

Query11

Analysis generated on: 4/2/2025 10:08:41 AM

SQL Statement

SELECT temp2.PartNumber, temp2.PN, temp2.ActualWt, [RMSFILES#_PSNWP1A0].NETWT, temp2.GrossWt, [RMSFILES#_PSNWP1A0].GRSWT, [RMSFILES#_PSNWP1A0].[MATL#], [RMSFILES#_IEMUP1A0].USAGE
FROM (temp2 LEFT JOIN [RMSFILES#_PSNWP1A0] ON temp2.PN = [RMSFILES#_PSNWP1A0].PRDNO) LEFT JOIN [RMSFILES#_IEMUP1A0] ON temp2.PN = [RMSFILES#_IEMUP1A0].PRDNO
WHERE (((Abs([ActualWt]-[NETWT]))>0.0001)) OR (((Abs([Grosswt]-[GRSWT]))>0.0001))
ORDER BY temp2.PN;

Dependencies

Parameters

  • None

What it does

SQL Query Description

Overview

This SQL query retrieves data from multiple tables and performs calculations to identify discrepancies in weight values.

Tables Involved

  • temp2: A temporary table containing data with columns:
    • PartNumber (PN)
    • PN ( alias for PartNumber )
    • ActualWt
    • GrossWt
    • MATL# (Material Number)
  • [RMSFILES#_PSNWP1A0]: A table containing data with columns:
    • PRDNO (Production Number, aliased as PN in the query)
    • NETWT (Nominal Weight)
    • GRSWT (Gross Weight)
  • [RMSFILES#_IEMUP1A0]: A table containing data with columns:
    • PRDNO (Production Number, aliased as PN in the query)
    • USAGE

Query Steps

  1. Join Temp Tables: The query joins two temporary tables: temp2 and [RMSFILES#_PSNWP1A0], and another table [RMSFILES#_IEMUP1A0]. The join is done on the PN column, which is aliased as PRDNO in the joined tables.
  2. Filter Discrepancies: The query filters rows where the absolute difference between ActualWt and NETWT (or Grosswt and GRSWT) is greater than 0.0001.
  3. Order Results: The final result is ordered by the PartNumber (PN) column.

Returned Columns

The query returns the following columns:

  • PartNumber
  • PN ( alias for PartNumber )
  • ActualWt
  • NETWT
  • GrossWt
  • GRSWT
  • MATL#
  • USAGE

Note that the PRDNO column is aliased as PN in the query, indicating that it represents the same data point.