0

I have table for recording client deposit, like this

Client_ID,deposit_amount,Time 

1 , 200 , 2014-03-27 05:32:10

2 , 500 , 2014-03-27 06:32:10

1 , 700 , 2014-03-28 04:24:26

I want to output like

2 , 500 , 2014-03-27 06:32:10

1 , 700 , 2014-03-28 04:24:26

How can I write a query to find the newest entry based on time.

Thank you

Ariful Islam
  • 7,639
  • 7
  • 36
  • 54
lai mang
  • 35
  • 1
  • 5

1 Answers1

0

You can use correlated subquery-

select * from tablename a
where time=(select max(time) from tablename b where a.client_id=b.client_id)
Fahmi
  • 37,315
  • 5
  • 22
  • 31