B
Ben
Hi all,
I have Access 2003 on WinXP. I have a table with:
PartID
TransactionID (runs in incremental order by 1)
DateOfSales
TotalCost
NumOfUnit
UnitPrice (which is a calculated field for TotalCost/NumOfUnit)
Each day we can have multiple sales transactions on a particular PartID,
and UnitPrice may be different based on the bulk volume. But what I
would like to do is to list all the PartID transactions, take the
largest TransactionID of that particular PartID. But it doesn't seem to
work, I still see multiple instances of the same PartID with their
TransactionIDs.
When there's multiple transaction on a PartID on a particular day, I
only want the record with the max TransactionID. Can you see what I
might be doing wrong?
SELECT
T.PartID,
Max(T.TransactionID) AS MaxOfTransactionID,
T.SalesDate,
T.TotalCost,
T.NumOfUnit,
T.UnitPrice
FROM Transaction AS T
GROUP BY
T.PartID,
T.SalesDate,
T.TotalCost,
T.NumOfUnit,
T.TotalCost/T.NumOfUnit,
HAVING (T.SalesDate=20091102) AND (T.TranType="Bulk")
ORDER BY T.PartID, Max(T.TransactionID)
Thanks in advance,
Ben
I have Access 2003 on WinXP. I have a table with:
PartID
TransactionID (runs in incremental order by 1)
DateOfSales
TotalCost
NumOfUnit
UnitPrice (which is a calculated field for TotalCost/NumOfUnit)
Each day we can have multiple sales transactions on a particular PartID,
and UnitPrice may be different based on the bulk volume. But what I
would like to do is to list all the PartID transactions, take the
largest TransactionID of that particular PartID. But it doesn't seem to
work, I still see multiple instances of the same PartID with their
TransactionIDs.
When there's multiple transaction on a PartID on a particular day, I
only want the record with the max TransactionID. Can you see what I
might be doing wrong?
SELECT
T.PartID,
Max(T.TransactionID) AS MaxOfTransactionID,
T.SalesDate,
T.TotalCost,
T.NumOfUnit,
T.UnitPrice
FROM Transaction AS T
GROUP BY
T.PartID,
T.SalesDate,
T.TotalCost,
T.NumOfUnit,
T.TotalCost/T.NumOfUnit,
HAVING (T.SalesDate=20091102) AND (T.TranType="Bulk")
ORDER BY T.PartID, Max(T.TransactionID)
Thanks in advance,
Ben