PSLine2000Documentation/Queries/Processes by material 3.md

2.2 KiB

Processes by material 3

Analysis generated on: 4/2/2025 10:06:44 AM

SQL Statement

SELECT Left$([PartNumber],7) AS PN, Process.*
FROM [Process by material] LEFT JOIN Process ON [Process by material].PN = Process.PartNumber;

Dependencies

Parameters

  • None

What it does

SQL Query Description

Overview

This SQL query performs a left outer join on two tables, [Process by material] and Process, based on the matching values in the PartNumber column. The query extracts the first 7 characters from the PartNumber column in the [Process by material] table and joins it with the corresponding records from the Process table.

Breakdown

  • SELECT Clause

    • LEFT$([PartNumber],7) AS PN: This line selects the first 7 characters of the PartNumber column from the [Process by material] table. The LEFT$() function is used to extract a specified number of characters from the beginning of the string. The resulting column is aliased as PN.
    • Process.*: This line selects all columns (*) from the Process table.
  • FROM Clause

    • [Process by material]: This line specifies the first table to be queried, which is [Process by material].
  • JOIN Clause

    • LEFT JOIN Process ON [Process by material].PN = Process.PartNumber: This line performs a left outer join on the two tables. The join condition is based on the matching values in the PartNumber column:
      • [Process by material].PN refers to the aliased PartNumber column from the first table.
      • Process.PartNumber refers to the original PartNumber column from the second table.

Result

The result of this query will be a table that includes all records from the [Process by material] table, with their corresponding matching records from the Process table. The PN alias represents the first 7 characters of the PartNumber column in the [Process by material] table.

Example Use Case

This query can be used to analyze processes based on part numbers. For instance, it could help identify all processes that have a specific part number or group parts with similar process names.