esteiner
Programmer
- Oct 31, 2003
- 24
Hello,
I would like to sort the results of my select statement before using aggregate functions such as the 'First' or 'Last'. How do I accomplish this?
Here is my current SQL:
SELECT pull_inv_BRE.ManfPartNum_NP,
First(pull_inv_BRE.ManfPartNum) AS FirstOfManfPartNum,
First(pull_inv_BRE.CorePartNum) AS FirstOfCorePartNum,
Sum(pull_inv_BRE.Quantity) AS Quantity
FROM pull_inv_BRE
WHERE (((pull_inv_BRE.ManfPartNum_NP) Like "am27128a" & "*") AND ((pull_inv_BRE.Description)<>"MENTOR"))
GROUP BY pull_inv_BRE.ManfPartNum_NP;
From this query, I would like to sort by pull_inv_BRE.ManfPartNum before using the 'First' function.
For example, ManfPartNum has two possible values:
"ABCD-2F1" and "ABCD2F1"
They both represent the same part number, but I would prefer to use the record with the "-" in it. That is why I want to to sort the records first and use the 'First' function.
I would like to sort the results of my select statement before using aggregate functions such as the 'First' or 'Last'. How do I accomplish this?
Here is my current SQL:
SELECT pull_inv_BRE.ManfPartNum_NP,
First(pull_inv_BRE.ManfPartNum) AS FirstOfManfPartNum,
First(pull_inv_BRE.CorePartNum) AS FirstOfCorePartNum,
Sum(pull_inv_BRE.Quantity) AS Quantity
FROM pull_inv_BRE
WHERE (((pull_inv_BRE.ManfPartNum_NP) Like "am27128a" & "*") AND ((pull_inv_BRE.Description)<>"MENTOR"))
GROUP BY pull_inv_BRE.ManfPartNum_NP;
From this query, I would like to sort by pull_inv_BRE.ManfPartNum before using the 'First' function.
For example, ManfPartNum has two possible values:
"ABCD-2F1" and "ABCD2F1"
They both represent the same part number, but I would prefer to use the record with the "-" in it. That is why I want to to sort the records first and use the 'First' function.