PSLine2000Documentation/Queries/Best Sheet For Material.md

47 lines
2.4 KiB
Markdown

# Best Sheet For Material
Analysis generated on: 4/2/2025 9:57:03 AM
---
## SQL Statement
```sql
SELECT [Util Selection C1].PartNumber, [Util Selection C1].BestSheetSet, [Util Selection C1].GrossWt, [Util Selection C1].Utilization, [Util Selection C1].Flag, [Line 8110731 Best on 1 Sheet].BestSheetSet, [Line 8110731 Best on 1 Sheet].GrossWt, [Line 8110731 Best on 1 Sheet].Utilization
FROM [Util Selection C1] INNER JOIN [Line 8110731 Best on 1 Sheet] ON [Util Selection C1].PartNumber = [Line 8110731 Best on 1 Sheet].PartNumber
ORDER BY [Util Selection C1].Flag;
```
## Dependencies
- *None*
## Parameters
- *None*
## What it does
**SQL Query Description**
==========================
This SQL query retrieves data from two tables, `[Util Selection C1]` and `[Line 8110731 Best on 1 Sheet]`, and combines them based on a common column, `PartNumber`.
### Table Overview
* `[Util Selection C1]`: This table contains information about different parts.
* Columns:
* `PartNumber`: The unique identifier for each part.
* `BestSheetSet`: The best sheet set for the part.
* `GrossWt`: The gross weight of the part.
* `Utilization`: The utilization rate of the part.
* `Flag`: A flag indicating some condition ( exact purpose is not clear).
* `[Line 8110731 Best on 1 Sheet]`: This table contains information about the best sheet set for each part when using one sheet.
* Columns:
* `BestSheetSet`: The best sheet set for the part.
* `GrossWt`: The gross weight of the part.
* `Utilization`: The utilization rate of the part.
### Query Logic
1. **Inner Join**: The query joins the two tables on the `PartNumber` column, which is common to both tables. This means that for each row in `[Util Selection C1]`, the corresponding row from `[Line 8110731 Best on 1 Sheet]` will be retrieved.
2. **Selected Columns**: The query selects specific columns from both tables:
* From `[Util Selection C1]`: `PartNumber`, `BestSheetSet`, `GrossWt`, `Utilization`, and `Flag`.
* From `[Line 8110731 Best on 1 Sheet]`: `BestSheetSet`, `GrossWt`, and `Utilization`.
3. **Sorting**: The query sorts the result set in ascending order based on the `Flag` column from `[Util Selection C1]`.
### Query Output
The final output of this query will be a table with the selected columns from both tables, sorted by the `Flag` column.