PSLine2000Documentation/Queries/MULTIPLE QUERY WITH 900'S O...

54 lines
1.8 KiB
Markdown

# MULTIPLE QUERY WITH 900'S ONLY
Analysis generated on: 4/2/2025 10:04:36 AM
---
## SQL Statement
```sql
SELECT *
FROM UniversalQ
WHERE ((UniversalQ.CutType="Multiple") AND ((Len(Trim$([PartNumber])))>=7) AND ((Left$(Trim$([PartNumber]),1))="9"));
```
## Dependencies
- [[Queries/UniversalQ]]
## Parameters
- *None*
## What it does
**Query Description**
======================
This SQL query selects all columns (`*`) from a table named `UniversalQ`. The query applies multiple conditions to filter the data.
### Conditions Applied
----------------------
The query filters the data based on three conditions:
#### 1. Cut Type: Multiple
-------------------------
The query starts by selecting only those rows where the `CutType` column is set to `"Multiple"`.
#### 2. Part Number Length and Prefix
-------------------------------------
The next condition checks if the length of the trimmed part number (`Trim$([PartNumber])`) is greater than or equal to 7 characters. Additionally, it verifies that the first character of the part number is `"9"`. This implies a specific prefix requirement for the part numbers.
#### 3. Data Filtering
----------------------
The final condition combines the previous conditions using logical `AND` operators:
* The query only selects rows where all three conditions are met (`UniversalQ.CutType="Multiple"` and both length and prefix checks pass).
**Query Details**
------------------
* The table name is `UniversalQ`.
* The query uses the `Len`, `Trim$,` and `Left$` functions to manipulate the part number data.
* The result set includes all columns (`*`) from the `UniversalQ` table.
**Example Use Case**
---------------------
This query might be used in an inventory management system to filter parts based on specific criteria, such as multiple cutting methods (e.g., milling or grinding) and part numbers with a particular prefix.