Hello
Can someone help me to put together an SQL statement to select the last 3 transactions from a transaction file.
In TransactSQL I would do something like this:
select top 3 CustID, TransDate, Amount
from Trans
where CustID= '12345'
order by TransDate desc.
I believe there must be a more effcient way of getting the latest 3 transactions.
Any help would be greatly appreciated.
Suhel.
Software/Hardware used:
ASKED:
May 22, 2007 6:54 AM
UPDATED:
May 15, 2008 5:52 PM
Suhel:
Your own solution looks fine to me. Just make sure that CustID and TransDate are indexed to make the query efficient.
Barry
you can add “FETCH FIRST x ROWS ONLY” and “WITH UR”
I beleive that DBq2 V9 has SQL enhancements for this type of query