Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello


I want to build a query in which i have to display the last date of transaction for every single commodity, every time the transaction happens on each day.

Plz need some help.
Posted

1 solution

You can simply order by date after filtering by transaction id using the where clause.
e.g select * from transactiontable where transactionid = [] order by transactiondate desc
will give you the last transaction date in the first row.
 
Share this answer
 
Comments
RDBurmon 13-Jun-12 9:18am    
slight modification with respect to performance improvement
select top 1 * from transactiontable where transactionid = [] order by transactiondate desc
Espen Harlinn 15-Jun-12 3:13am    
5'ed!
Abhinav S 15-Jun-12 3:39am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900