Jayden Ng
Jayden Ng

Reputation: 151

Query for a latest updateTime for specific user

I have a table that a user placing bets on dUpdateTime.

DB Table : enter image description here

enter image description here

My Query :

select * from tbet where iUserKey=53298 

How do I create a query that would give me the latest dUpdateTime with iUserKey = 53298.

Upvotes: 2

Views: 64

Answers (3)

Leigh Cheri
Leigh Cheri

Reputation: 125

Use max aggregate function to get the latest

SELECT MAX(dUpdateTime) FROM tbet WHERE iUserKey=53298 

Upvotes: 1

Gulmuhammad Akbari
Gulmuhammad Akbari

Reputation: 2036

Try this:

select * from tbet where iUserKey=53298 order by dUpdateTime desc limit 1

Upvotes: 1

Arulkumar
Arulkumar

Reputation: 13237

Using MAX aggregate function

SELECT MAX(dUpdateTime) FROM tbet WHERE iUserKey = 53298 

Upvotes: 5

Related Questions