2.6 KiB
2.6 KiB
Util Make Select 0b
Analysis generated on: 4/2/2025 10:14:14 AM
SQL Statement
SELECT "x X X" AS BestSheetSet, [Filtered Parts 3].PN, Process1.* INTO [Util Selection 0b]
FROM Process1 RIGHT JOIN ([Filtered Parts 3] LEFT JOIN Process ON [Filtered Parts 3].PN = Process.PartNumber) ON Process1.PartNumber = [Filtered Parts 3].PN
WHERE (((Process.PartNumber) Is Null) AND ((Process1.PartNumber)=[pn]))
ORDER BY Process.PartNumber;
Dependencies
Parameters
- None
What it does
SQL Query Description
Overview
This SQL query performs a complex join operation to retrieve filtered data from multiple tables. The goal is to identify the best sheet set based on certain conditions.
Table Involved
The following tables are involved in this query:
Process1
: A table containing process-related data with columnsPartNumber
and other unspecified fields (*
).[Filtered Parts 3]
: A table containing filtered parts data with a columnPN
.Process
: Another table containing process data with a columnPartNumber
.
Query Steps
- Join Operation: The query first performs an inner join between the
Process1
and[Filtered Parts 3]
tables based on thePN
column, resulting in a new temporary table. - Left Join with Process Table: Then, it performs another left join between the temporary table from step 1 and the
Process
table. The join condition is that thePN
column from both tables must match. - Filtering and Sorting: After joining the tables, the query filters out rows where either the
PartNumber
inProcess
orProcess1
is null. It also adds a filter to select only rows where[pn]
equals thePartNumber
inProcess1
. - Grouping and Aggregation: The query groups the remaining rows by the
PartNumber
column from both tables. - Output: Finally, it selects specific columns (
BestSheetSet
,PN
) from the filtered and grouped data and assigns a default value"x X X"
to theBestSheetSet
column.
Output
The query produces a new table named [Util Selection 0b]
with the following structure:
BestSheetSet | PN |
---|---|
"x X X" | filtered_PN |
Note that the actual output will depend on the data in the Process1
, [Filtered Parts 3]
, and Process
tables.
Note
The use of Is Null
condition in the WHERE clause is unusual. Typically, this would be written as IS NULL
. However, based on your SQL code, I have followed it as-is to maintain consistency with your original query.