PSLine2000Documentation/Queries/CntlPanel5.md

51 lines
2.2 KiB
Markdown

# CntlPanel5
Analysis generated on: 4/2/2025 9:57:55 AM
---
## SQL Statement
```sql
SELECT Left([partnumber],7) AS prt, Right([partnumber],1) AS Rev, CntlPanel4.Process.PartNumber AS PartNumber, CntlPanel4.Flag, CntlPanel4.FirstDim, CntlPanel4.SecDim, CntlPanel4.PartHeight, CntlPanel4.PartWidth, CntlPanel4.MetalType INTO [Util Selection 2]
FROM CntlPanel4;
```
## Dependencies
- *None*
## Parameters
- *None*
## What it does
**SQL Query Description**
==========================
This SQL query retrieves specific data from the `CntlPanel4` table and reorganizes it into a new table called `[Util Selection 2]`.
### Query Breakdown
The query uses several key elements:
* **Subqueries and Aliases**: The query selects data from multiple columns in the `CntlPanel4` table, aliasing them as follows:
* `[partnumber]`: Retrieved using `Left` and `Right` functions to extract specific parts of the value.
* `Left([partnumber],7) AS prt`: Extracts the first 7 characters from the left side of `[partnumber]`.
* `Right([partnumber],1) AS Rev`: Extracts the last character from the right side of `[partnumber]`.
* Other columns are aliased directly.
* **Data Retrieval**: The query retrieves data from the specified columns in the `CntlPanel4` table and stores it in the new `[Util Selection 2]` table.
### SQL Query Steps
1. Selects specific columns from the `CntlPanel4` table.
* Retrieves the first 7 characters of the left side of the `[partnumber]`, assigns it to the column named `prt`.
* Retrieves the last character of the right side of the `[partnumber]`, assigns it to the column named `Rev`.
* Retrieves the values of the other columns (`PartNumber`, `Flag`, `FirstDim`, `SecDim`, `PartHeight`, and `PartWidth`) from the table.
2. Stores the retrieved data in a new table called `[Util Selection 2]`.
3. The query uses an `INTO` clause to specify that the retrieved data should be stored in the newly created table.
### SQL Query Result
The resulting table `[Util Selection 2]` will contain 7 columns:
* `prt`: The first 7 characters of the left side of the `[partnumber]`.
* `Rev`: The last character of the right side of the `[partnumber]`.
* `PartNumber`
* `Flag`
* `FirstDim`
* `SecDim`
* `PartHeight`