61 lines
3.4 KiB
Markdown
61 lines
3.4 KiB
Markdown
# Q1
|
|
Analysis generated on: 4/2/2025 10:07:35 AM
|
|
---
|
|
## SQL Statement
|
|
```sql
|
|
SELECT DISTINCTROW Process.PartName, Process.PartNumber, Process.RevisionLevel, Process.IssueNumber, Process.IssueDate, Process.PreviousIssue, Process.PreviousDate, Process.Programmer, Process.PrintSize, Process.History, Process.MetalType, Process.CutType, Process.PrimeMachine, Process.GrainDir, Process.Deburr, Process.FirstDim, Process.SecDim, Process.PartHeight, Process.BotTrimCut, Process.TopTrimCut, Process.PartWidth, Process.BlankSize, Process.PartSize, Process.GrossWt, Process.ActualWt, Process.Utilization, Process.SheetSize, AddnlProc.ID, AddnlProc.Generated, AddnlProc.OPCode, AddnlProc.Description, AddnlProc.WC1, AddnlProc.WC2, AddnlProc.WC3, AddnlProc.WC4, AddnlProc.Machine, AddnlProc.CycleTime, AddnlProc.RunStd, Process.PartsPerBlank, Process.PartsPerSheet, Process.BlocksPerSheet, Process.BlanksPerBlock, Metals.MetalName, Metals.Gauge, Metals.Density, Process.MaterialCost, Process.LaborCost, Process.PartCost, Process.Reason, Process.CalculationStatus, Metals.Units
|
|
FROM (Process INNER JOIN Metals ON Process.MetalType = Metals.PartNo) INNER JOIN AddnlProc ON Process.PartNumber = AddnlProc.PartNumber
|
|
WHERE (((Process.PartNumber)=[Forms]![Process Sheet]![Partnumber]) AND ((Left([OPCode],1))<>"*" And (Left([OPCode],1))<>"!" And (Left([OPCode],1))<>"@" And (Left([OPCode],1))<>"$"));
|
|
|
|
```
|
|
## Dependencies
|
|
- [[Queries/Metals]]
|
|
- [[Tables/AddnlProc]]
|
|
## Parameters
|
|
- [Forms]![Process Sheet]![Partnumber] (Empty)
|
|
## What it does
|
|
**Detailed SQL Code Description**
|
|
=====================================
|
|
|
|
### Overview
|
|
|
|
This SQL query retrieves a distinct set of processed parts details from the `Process` and `AddnlProc` tables, joined with the `Metals` table. The query filters results based on specific conditions related to part numbers, operation codes, and metal types.
|
|
|
|
### Query Breakdown
|
|
----------------------
|
|
|
|
1. **Table Selection**
|
|
|
|
* `SELECT`: Retrieves data from multiple tables.
|
|
* `DISTINCTROW`: Ensures that each row returned is unique (i.e., no duplicates).
|
|
|
|
2. **Joining Tables**
|
|
|
|
* The query joins three tables:
|
|
1. `Process`
|
|
2. `Metals` on the condition that `PartNo` in `Process` matches `MetalType` in `Metals`.
|
|
3. `AddnlProc` on the condition that `PartNumber` in `Process` matches `PartNumber` in `AddnlProc`.
|
|
|
|
3. **Filtering Conditions**
|
|
|
|
* The query applies several filtering conditions:
|
|
1. `WHERE` clause filters results based on the following conditions:
|
|
* `Partnumber`: Must equal a value stored in the `Partnumber` field of a form control (`Forms![Process Sheet]![Partnumber]`).
|
|
* `OPCode`: Must not start with `"*"`, `"!"` , `"@"` or `$`. This suggests that only specific operation codes are allowed.
|
|
|
|
### Returned Columns
|
|
----------------------
|
|
|
|
The query returns a comprehensive set of columns from the joined tables, including:
|
|
|
|
* Part details (e.g., `PartName`, `PartNumber`)
|
|
* Process information (e.g., `RevisionLevel`, `IssueDate`)
|
|
* Metal type and material cost details (e.g., `MetalType`, `MaterialCost`)
|
|
* Additional processing data (e.g., `Programmer`, `PrintSize`)
|
|
* Calculation status and utilization metrics (e.g., `CalculationStatus`, `Utilization`)
|
|
|
|
### Note
|
|
---------
|
|
|
|
This query seems to be designed for a specific application, possibly related to metal fabrication or manufacturing. The use of forms controls (`Forms![Process Sheet]![Partnumber]`) suggests that the data is being generated based on user input.
|