PSLine2000Documentation/Queries/Q2.md

3.9 KiB

Q2

Analysis generated on: 4/2/2025 10:07:58 AM

SQL Statement

SELECT DISTINCTROW Process.PartNumber, Process.PartName, Process.RevisionLevel, Process.IssueNumber, Process.IssueDate, Process.PreviousIssue, Process.PreviousDate, Process.Programmer, Process.PrintSize, Process.History, Process.MetalType, Process.CutType, Process.PrimeMachine, Process.GrainDir, Process.Deburr, Process.FirstDim, Process.SecDim, Process.PartHeight, Process.BotTrimCut, Process.TopTrimCut, Process.PartWidth, Process.BlankSize, Process.PartSize, Process.GrossWt, Process.ActualWt, Process.Utilization, Process.SheetSize, AddnlProc.ID, AddnlProc.Generated, AddnlProc.OPCode, AddnlProc.Description, AddnlProc.WC1, AddnlProc.WC2, AddnlProc.WC3, AddnlProc.WC4, AddnlProc.Machine, AddnlProc.CycleTime, AddnlProc.RunStd, Process.PartsPerBlank, Process.PartsPerSheet, Process.BlocksPerSheet, Process.BlanksPerBlock, Metals.MetalName, Metals.Gauge, Metals.Density, Process.MaterialCost, Process.LaborCost, Process.PartCost, Process.Reason, Metals.Units
FROM (Process INNER JOIN Metals ON Process.MetalType = Metals.PartNo) INNER JOIN AddnlProc ON Process.PartNumber = AddnlProc.PartNumber
WHERE ((Process.PartNumber=[Forms]![Data Sheet Select]![Field1]) AND ((Left([OPCode],1))<>"*" And (Left([OPCode],1))<>"!" And (Left([OPCode],1))<>"@" And (Left([OPCode],1))<>"$"));

Dependencies

Parameters

  • [Forms]![Data Sheet Select]![Field1] (Empty)

What it does

SQL Query Description

This SQL query retrieves distinct rows from the Process table, joined with the Metals and AddnlProc tables. The query filters data based on specific conditions.

Joined Tables

The query joins three tables:

  • Process: contains process information
  • Metals: contains metal information
  • AddnlProc: contains additional processing information (e.g., operations, descriptions)

Selected Columns

The query selects the following columns from the joined tables:

  • Process table:
    • PartNumber
    • PartName
    • RevisionLevel
    • IssueNumber
    • IssueDate
    • PreviousIssue
    • PreviousDate
    • Programmer
    • PrintSize
    • History
    • MetalType
    • CutType
    • PrimeMachine
    • GrainDir
    • Debur
    • FirstDim
    • SecDim
    • PartHeight
    • BotTrimCut
    • TopTrimCut
    • PartWidth
    • BlankSize
    • PartSize
    • GrossWt
    • ActualWt
    • Utilization
    • SheetSize
  • Metals table:
    • MetalName
    • Gauge
    • Density
  • AddnlProc table:
    • ID
    • Generated
    • OPCode
    • Description
    • WC1, WC2, WC3, and WC4 ( likely code snippets or comments)
    • Machine
    • CycleTime
    • RunStd

Filtering Conditions

The query applies the following filtering conditions:

  • The PartNumber must match a value in the [Forms]![Data Sheet Select]![Field1] field (presumably a dropdown or text input).
  • The first character of the OPCode column (Left([OPCode], 1)) must not be " "*", "!", "@", or "$".
  • The remaining characters of the OPCode column must match the specified filtering criteria.

SELECT DISTINCTROW Clause

The query uses the SELECT DISTINCTROW clause to retrieve only unique rows from the joined tables, based on the columns selected in the query.

Query Structure

The query structure consists of:

  1. Inner joins: The query joins the Process, Metals, and AddnlProc tables using the corresponding keys.
  2. Filtering conditions: The query applies filtering conditions to the joined data.
  3. Selected columns: The query selects specific columns from the joined tables.

Overall, this query retrieves process information with associated metal and additional processing details, filtered based on a specified part number and OPCode criteria.