PSLine2000Documentation/Queries/Util Result1 for steve.md

54 lines
2.5 KiB
Markdown

# Util Result1 for steve
Analysis generated on: 4/2/2025 10:15:28 AM
---
## SQL Statement
```sql
SELECT [Util Selection 3].*, Process.* INTO [Steve's C1]
FROM ([Util Selection 3] LEFT JOIN [Sorted By Machines 1] ON [Util Selection 3].PRDNO = [Sorted By Machines 1].prt) LEFT JOIN Process ON [Sorted By Machines 1].PartNumber = Process.PartNumber;
```
## Dependencies
- [[Tables/Machines]]
- [[Tables/Process]]
## Parameters
- *Error analyzing parameters: For loop not initialized*
## What it does
**SQL Query Description**
==========================
This SQL query performs a complex join operation to retrieve data from multiple tables and populate two derived tables with the selected columns.
### Table Names and Columns
* `[Util Selection 3]`: A table containing data for "Util Selection 3".
* `[Sorted By Machines 1]`: A table containing data for "Sorted By Machines 1".
* `Process`: A table containing additional process-related data.
* `PRDNO`, `PartNumber`: Common column names used in the join operations.
### Query Steps
The query consists of three main steps:
#### Step 1: Left Join `[Util Selection 3]` with `[Sorted By Machines 1]`
This step performs a left join between the two tables on the `PRDNO` column, which is common to both tables. This ensures that all records from `[Util Selection 3]` are included in the results, even if there are no matching records in `[Sorted By Machines 1]`.
#### Step 2: Left Join the result with `Process`
This step performs another left join between the previous result and the `Process` table on the `PartNumber` column. This ensures that all records from the first two tables are included in the results, even if there are no matching records in `Process`.
#### Result
The final result is populated into a derived table named `[Steve's C1]`, which includes all columns (`*`) from both `[Util Selection 3]` and `Process`. The resulting table contains data from all three tables, joined on the common `PRDNO` and `PartNumber` columns.
### Output
The query produces a table with two derived tables:
* `[Steve's C1]`: A table containing the selected columns from both `[Util Selection 3]` and `Process`.
* The original data in `[Util Selection 3]`, [Sorted By Machines 1], and Process are also included.
### Notes
The use of left joins ensures that all records from the first two tables are included in the results, even if there are no matching records in `Process`. This can be useful for maintaining data integrity and completeness.