Jayden Ng Jayden Ng - 4 months ago 9
SQL Question

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
.

Answer

Using MAX aggregate function

SELECT MAX(dUpdateTime) FROM tbet WHERE iUserKey = 53298