61 lines
2.6 KiB
Markdown
61 lines
2.6 KiB
Markdown
# Util Result3
|
|
Analysis generated on: 4/2/2025 10:15:44 AM
|
|
---
|
|
## SQL Statement
|
|
```sql
|
|
INSERT INTO [Util Selection C1] ( OriginalPartW )
|
|
SELECT [Util Selection 3].*, [Util Selection 1].*, [Util Selection 1].ActualPartWidth AS OriginalPartW
|
|
FROM ([Util Selection 3] LEFT JOIN [Util Selection 2] ON [Util Selection 3].PRDNO = [Util Selection 2].prt) LEFT JOIN [Util Selection 1] ON [Util Selection 2].PartNumber = [Util Selection 1].PartNumber;
|
|
|
|
```
|
|
## Dependencies
|
|
- *None*
|
|
## Parameters
|
|
- *Error analyzing parameters: For loop not initialized*
|
|
## What it does
|
|
**SQL Code Explanation**
|
|
=========================
|
|
|
|
### Overview
|
|
|
|
This SQL code performs an INSERT operation into a table named `[Util Selection C1]`, populating it with data from three other tables: `[Util Selection 3]`, `[Util Selection 2]`, and `[Util Selection 1]`.
|
|
|
|
### Table Operations
|
|
|
|
#### Insert Operation
|
|
|
|
* The code inserts new records into the `[Util Selection C1]` table.
|
|
* The data is retrieved from the specified source tables using SELECT statements.
|
|
|
|
#### Join Operations
|
|
|
|
* The code uses LEFT JOINs to combine rows from multiple tables based on common columns:
|
|
* The first `LEFT JOIN [Util Selection 2] ON [Util Selection 3].PRDNO = [Util Selection 2].prt` combines rows from `[Util Selection 3]` and `[Util Selection 2]` based on the `PRDNO` column.
|
|
* The second `LEFT JOIN [Util Selection 1] ON [Util Selection 2].PartNumber = [Util Selection 1].PartNumber` combines the result of the previous join with rows from `[Util Selection 1]`, based on the `PartNumber` column.
|
|
|
|
#### SELECT Statement
|
|
|
|
* The code selects specific columns from the joined tables:
|
|
* All columns (`*`) are selected from `[Util Selection 3]`.
|
|
* Columns are selected from `[Util Selection 2]`, including the alias `ActualPartWidth AS OriginalPartW`.
|
|
* Only the `PartNumber` column is selected from `[Util Selection 1]`.
|
|
|
|
### Data Retrieval
|
|
|
|
The code retrieves the following data:
|
|
|
|
* All columns (`*`) from `[Util Selection 3]`.
|
|
* The `ActualPartWidth` column from `[Util Selection 2]`, which will be aliased as `OriginalPartW`.
|
|
* The `PartNumber` column from `[Util Selection 1]`.
|
|
|
|
### Join Conditions
|
|
|
|
The join conditions are based on the following relationships:
|
|
|
|
* A row in `[Util Selection 3]` is joined with a row in `[Util Selection 2]` if they share the same `PRDNO`.
|
|
* The resulting rows are then joined with rows from `[Util Selection 1]` if they share the same `PartNumber`.
|
|
|
|
### Result
|
|
|
|
The final result will be an INSERT operation that populates the `[Util Selection C1]` table with data from the specified source tables, using the selected columns and join conditions.
|