2.5 KiB
2.5 KiB
Processes by material
Analysis generated on: 4/2/2025 10:05:56 AM
SQL Statement
SELECT Left$([PartNumber],7) AS prt, Trim$(Right$([PartNumber],1)) AS Rev, Process.PartNumber AS PartNumber, Process.MetalType, Left$([PartNumber],1) AS stfdsvgde
FROM Process
WHERE (((Process.MetalType)=[Forms]![Material Upgrade]![txtMaterial]) AND ((Left$([PartNumber],1))="2" Or (Left$([PartNumber],1))="9" Or (Left$([PartNumber],1))="8" Or (Left$([PartNumber],1))="1"))
ORDER BY Left$([PartNumber],7), Trim$(Right$([PartNumber],1)) DESC , Left$([PartNumber],1);
Dependencies
Parameters
- [Forms]![Material Upgrade]![txtMaterial] (Empty)
What it does
SQL Query Description
This SQL query retrieves specific data from a database table named Process
based on certain conditions. The query uses various string manipulation functions and filters the results to produce a list of part numbers, metal types, and other relevant information.
Key Functions Used
Left$([PartNumber],7)
: Returns the first 7 characters of thePartNumber
column.Trim$(Right$([PartNumber],1))
: Removes the last character from the right side of thePartNumber
column and trims any leading or trailing whitespace.Process.PartNumber AS PartNumber
: Selects thePartNumber
column from theProcess
table and assigns it an aliasPartNumber
.Left$([PartNumber],1)
: Returns the first character of thePartNumber
column.
Filtering Conditions
The query applies several conditions to filter the results:
- Metal Type: The metal type must match the value in the
[Forms]![Material Upgrade]![txtMaterial]
field. - Part Number Prefix: The part number prefix must be either "2", "9", "8", or "1" (in any case).
Sorting and Ordering
The results are sorted by:
Left$([PartNumber],7)
in ascending orderTrim$(Right$([PartNumber],1))
in descending orderLeft$([PartNumber],1)
in ascending order
Output
The query returns a list of part numbers, metal types, and other relevant information, sorted according to the specified criteria.
Example Output
prt (7-character substring) | Rev (last character removed) | PartNumber | MetalType |
---|---|---|---|
XXXXXXXX | 1 | XYZ1234569 | Material A |
XXXXXXXX | 2 | ABC2345678 | Material B |
... | ... | ... | ... |
Note that the actual output will depend on the data in the Process
table and the values in the [Forms]![Material Upgrade]![txtMaterial]
field.