PSLine2000Documentation/Queries/MachinesQ1.md

1.8 KiB

MachinesQ1

Analysis generated on: 4/2/2025 10:02:18 AM

SQL Statement

SELECT DISTINCTROW Machines.PartNumber, Machines.MachineName, Machines.CycleTime, Machines.Tool, Machines.Prime
FROM Machines
ORDER BY Machines.PartNumber, Machines.MachineName;

Dependencies

Parameters

  • None

What it does

SQL Query Description

Overview

This SQL query retrieves a list of unique machine details from the Machines table, ordered by part number and machine name.

Breakdown

SELECT Clause

SELECT DISTINCTROW 

The DISTINCTROW keyword is used to ensure that each row returned in the result set contains unique values for all columns specified. This clause eliminates duplicate rows from the result set.

Columns Specified

Machines.PartNumber, Machines.MachineName, Machines.CycleTime, Machines.Tool, Machines.Prime

The query selects specific columns from the Machines table:

  • PartNumber: a unique identifier for each machine
  • MachineName: the name of the machine
  • CycleTime: the time taken by the machine to complete a cycle
  • Tool: the tool used in the machine
  • Prime: an unknown column ( possibly used as a flag or indicator)

FROM Clause

FROM Machines

The query is executed on the Machines table.

ORDER BY Clause

ORDER BY 
Machines.PartNumber, Machines.MachineName;

The result set is ordered by:

  • PartNumber: ascending order (smallest part number first)
  • MachineName: ascending order (alphabetical order of machine names)

Purpose and Use Cases

This query can be used in various scenarios, such as:

  • Displaying a list of unique machines with their details
  • Preparing data for further analysis or reporting
  • Filtering out duplicate machines from a large dataset