PSLine2000Documentation/Queries/Query13.md

68 lines
2.5 KiB
Markdown

# Query13
Analysis generated on: 4/2/2025 10:08:58 AM
---
## SQL Statement
```sql
SELECT Max(Process.PartNumber) AS MaxOfPartNumber, Process.CutType, Process.GrainDir, Process.FirstDim, Process.SecDim, Process.PartsPerBlank, Process.PartsPerSheet, Process.BlocksPerSheet, Process.MetalType
FROM Process
GROUP BY Process.CutType, Process.GrainDir, Process.FirstDim, Process.SecDim, Process.PartsPerBlank, Process.PartsPerSheet, Process.BlocksPerSheet, Process.MetalType;
```
## Dependencies
- [[Tables/Process]]
## Parameters
- *None*
## What it does
**SQL Query Description**
=====================================
### Overview
This SQL query retrieves a set of aggregated values from the `Process` table, grouping data by various columns and calculating the maximum value for one column.
### Details
#### SELECT Clause
The query selects specific columns from the `Process` table:
* `MaxOfPartNumber`: The maximum part number.
* `CutType`, `GrainDir`, `FirstDim`, `SecDim`, `PartsPerBlank`, `PartsPerSheet`, `BlocksPerSheet`, and `MetalType`: Various process-related values.
#### GROUP BY Clause
The query groups the data by the following columns:
* `CutType`
* `GrainDir`
* `FirstDim`
* `SecDim`
* `PartsPerBlank`
* `PartsPerSheet`
* `BlocksPerSheet`
* `MetalType`
This means that the selected values will be aggregated separately for each unique combination of these columns.
#### Description of Result
The query returns a result set with the following structure:
| Column Name | Data Type | Description |
| --- | --- | --- |
| MaxOfPartNumber | integer | The maximum part number corresponding to each group. |
| CutType | string | The cut type for each group. |
| GrainDir | string | The grain direction for each group. |
| FirstDim | decimal | The first dimension value for each group. |
| SecDim | decimal | The second dimension value for each group. |
| PartsPerBlank | integer | The number of parts per blank for each group. |
| PartsPerSheet | integer | The number of parts per sheet for each group. |
| BlocksPerSheet | integer | The number of blocks per sheet for each group. |
| MetalType | string | The metal type for each group. |
This result set shows the maximum part number and other relevant process values for each unique combination of the specified columns.
### Example Use Case
This query can be used to analyze production data, identify trends, and optimize manufacturing processes by grouping similar operations together and calculating key performance indicators (KPIs) such as the maximum part number per cut type or grain direction.