PSLine2000Documentation/Queries/PressBrakeQ1.md

1.7 KiB

PressBrakeQ1

Analysis generated on: 4/2/2025 10:05:27 AM

SQL Statement

SELECT DISTINCTROW PressBrakeOPs.PartNumber, PressBrakeOPs.OpCode, PressBrakeOPs.Step, PressBrakeOPs.Angle, PressBrakeOPs.Comment, PressBrakeOPs.Breaks, PressBrakeOPs.Hits
FROM PressBrakeOPs
ORDER BY PressBrakeOPs.PartNumber, PressBrakeOPs.OpCode, PressBrakeOPs.Step;

Dependencies

Parameters

  • None

What it does

SQL Query Description

Overview

This SQL query retrieves distinct rows from the PressBrakeOPs table, selecting specific columns and ordering the results.

Columns Selected

The query selects the following distinct columns:

  • PartNumber
  • OpCode
  • Step
  • Angle
  • Comment
  • Breaks
  • Hits

Table Source

The query is sourced from the PressBrakeOPs table.

Sorting Order

The results are ordered by the following columns in ascending order:

  1. PartNumber
  2. OpCode
  3. Step

DistinctROW Clause

The SELECT DISTINCTROW clause ensures that each row is returned only once, even if there are duplicate rows with the same values for the selected columns.

Query Execution

When executed, this query will:

  1. Retrieve distinct rows from the PressBrakeOPs table.
  2. Select the specified columns.
  3. Order the results based on the specified columns.
  4. Return only one row per unique combination of column values.

Example Use Case

This query can be used to:

  • Retrieve a list of distinct operations for each part number, ordered by operation code and step number.
  • Analyze the performance of different parts or operations over time.
  • Identify duplicate rows that need to be corrected in the database.