Reputation: 118
SELECT ID, AppID, Description, Min([Transaction Date]) AS 'Transacton Date'
FROM AppProsHist
WHERE [Description]='Non-Final Rejection'
GROUP BY ID, AppID, Description
I thought this would allow for only the first (earliest) transaction date to be shown in my table, however, this still shows each transaction date. Is there a way to alter this so that I receive just one Date for the ID, AppID, Description?
Upvotes: 0
Views: 58
Reputation: 36
You should use ORDER BY
and LIMIT 1
to get the first record of the ordered set. ASC
or DESC
while ordering will set the direction in which to sort. So try
SELECT TOP 1 ID, AppID, Description, Min([Transaction Date]) AS TransactionDate
FROM AppProsHist
WHERE [Description]='Non-Final Rejection'
GROUP BY ID, AppID, Description
ORDER BY TransactionDate DESC, ID
Upvotes: 2