Search This Blog

Monday, March 4, 2019

Find out latest transaction for particular Customers.


select * from  [dbo].[Transaction] order by name




ID
name
Transdate
Transnumber
Product
4
CP       
2019-02-12 00:00:00.000
1004
TOY      
7
CP       
2019-03-01 00:00:00.000
1007
TOY      
1
rahul    
2019-02-02 00:00:00.000
1001
book     
2
rahul    
2019-02-12 00:00:00.000
1002
book     
3
RAVI     
2019-02-15 00:00:00.000
1003
TOY      
5
RP       
2019-02-13 00:00:00.000
1005
BOOK     
8
RP       
2019-02-28 00:00:00.000
1008
BOOK     
6
SUMIT    
2019-02-12 00:00:00.000
1006
BOOK     


select
max(Transdate),name,product from [dbo].[Transaction] group by product,name


transaction date
name
product
2019-03-01 00:00:00.000
CP       
TOY      
2019-02-12 00:00:00.000
rahul    
book     
2019-02-15 00:00:00.000
RAVI     
TOY      
2019-02-28 00:00:00.000
RP       
BOOK     
2019-02-12 00:00:00.000
SUMIT    
BOOK     

No comments :