Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how can i get d last transaction

Author  Topic 

shaik.zakeer
Posting Yak Master

117 Posts

Posted - 2008-04-24 : 09:03:50
Hi


i have a table


bank cr dr datetime

icici 10000 --- 1/1/2007 -- 1 transaction
hdfc 5000 ------- 1/1/2007
icici --- 8000 1/1/2007 --- 2 transaction
hdfc ---- 2000 1/1/2007


how can i get the last transaction in a perticular date in all d banks



Thanks

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-04-24 : 09:09:45
hi,

if u r datetime field contains time part also then u can simply use
max(datetime)
other wise use
ROW_number () over(partition by bank, datetime order by bank) some thing like that
Go to Top of Page
   

- Advertisement -