PSLine2000Documentation/Queries/Metals_As400_Comparison.md

62 lines
2.2 KiB
Markdown

# Metals_As400_Comparison
Analysis generated on: 4/2/2025 10:04:28 AM
---
## SQL Statement
```sql
SELECT [Metals Header].PartNo, [Metals Header].PricePerLB, [RMSFILES#_MSPMLVPT].STDC1
FROM [Metals Header] INNER JOIN [RMSFILES#_MSPMLVPT] ON [Metals Header].PartNo = [RMSFILES#_MSPMLVPT].PRDNO;
```
## Dependencies
- [[Tables/[RMSFILES__MSPMLVPT]]]
## Parameters
- *None*
## What it does
**SQL Query Description**
==========================
### Overview
This SQL query retrieves data from two tables: `[Metals Header]` and `[RMSFILES#_MSPMLVPT]`. It performs an inner join on the `PartNo` column to combine rows from both tables based on matching values.
### Query Breakdown
#### SELECT Clause
The `SELECT` clause specifies the columns to be retrieved:
* `[Metals Header].PartNo`: The Part Number from the `[Metals Header]` table.
* `[Metals Header].PricePerLB`: The Price Per Pound of the material from the `[Metals Header]` table.
* `[RMSFILES#_MSPMLVPT].STDC1`: A standard value from the `[RMSFILES#_MSPMLVPT]` table.
#### FROM Clause
The `FROM` clause specifies the tables to be used:
* `[Metals Header]`: The primary table containing metadata about metals.
* `[RMSFILES#_MSPMLVPT]`: The secondary table containing data related to production and pricing.
#### INNER JOIN Clause
The `INNER JOIN` clause performs an inner join on the `PartNo` column to combine rows from both tables:
* Both tables must have a matching value in the `PartNo` column for the join to occur.
* Only rows with a match are included in the result set.
#### ON Clause
The `ON` clause specifies the condition for the join:
* The join is performed on the `PartNo` column, which is common to both tables.
* The matching value in each table must have the same data type (in this case, integers) for the join to work correctly.
### Result Set
The query returns a result set containing three columns:
| Part No | Price Per LB | STDC1 |
| --- | --- | --- |
| | | |
This query is likely used to retrieve pricing information and standard values associated with specific metal parts. The exact meaning of the `STDC1` column depends on the context in which it is used, but it appears to be a static value returned from the `[RMSFILES#_MSPMLVPT]` table.