PSLine2000Documentation/Queries/PemStuff.md

60 lines
2.6 KiB
Markdown

# PemStuff
Analysis generated on: 4/2/2025 10:05:10 AM
---
## SQL Statement
```sql
SELECT [PemPress Studs].PemNumber, [PemPress Studs].Studsize, PemPressTooling.PunchAuto, PemPressTooling.AnvilAuto, PemPressTooling.PunchMan, PemPressTooling.AnvilMan
FROM [PemPress Studs] LEFT JOIN PemPressTooling ON [PemPress Studs].Studsize = PemPressTooling.StudSize;
```
## Dependencies
- [[Tables/PemPressTooling]]
## Parameters
- *None*
## What it does
**SQL Query Description**
=========================
### Overview
This SQL query retrieves data from two tables, `[PemPress Studs]` and `PemPressTooling`, and performs a LEFT JOIN operation to combine the data.
### Table Information
* **[PemPress Studs]**: This table contains information about stud sizes.
* Columns:
* `PemNumber`: Unique identifier for each stud size
* `Studsize`: The size of the stud (e.g., "Small", "Medium", "Large")
* **[PemPress Tooling]**: This table contains information about tooling settings.
* Columns:
* `PunchAuto`: Auto-punch setting for the tool
* `AnvilAuto`: Auto-anvil setting for the tool
* `PunchMan`: Manual punch setting for the tool
* `AnvilMan`: Manual anvil setting for the tool
### JOIN Operation
The query performs a LEFT JOIN operation between `[PemPress Studs]` and `PemPressTooling` tables based on the `Studsize` column. The resulting data includes all records from both tables, with the missing values filled in with NULL (NULL being the default value for non-matching rows).
### Result
The query returns a combined table with the following columns:
* `PemNumber`: Unique identifier for each stud size
* `Studsize`: The size of the stud
* `PunchAuto`, `AnvilAuto`, `PunchMan`, and `AnvilMan`: Tooling settings from the `PemPressTooling` table, corresponding to the `Studsize` in the `[PemPress Studs]` table.
### Example Use Case
This query can be used to retrieve the tooling settings for each stud size in a production environment. The resulting data can be used to optimize the manufacturing process by providing the necessary tooling settings for each product variant.
```markdown
| PemNumber | Studsize | PunchAuto | AnvilAuto | PunchMan | AnvilMan |
| --- | --- | --- | --- | --- | --- |
| 1 | Small | Auto | Manual | | |
| 2 | Medium | Auto | Manual | Auto | Manual |
| 3 | Large | Manual | Auto | | |
```
In this example, the resulting data includes all records from both tables, with NULL values filled in for missing data.