SQL - fetch the row which has the Max value for a column

Posted by Umang on Stack Overflow See other posts from Stack Overflow or by Umang
Published on 2008-09-23T14:34:13Z Indexed on 2010/05/02 15:17 UTC
Read the original article Hit count: 397

Filed under:
|
|

Table: UserId, Value, Date.

I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. Is there a way to do this simply in SQL? (Preferably Oracle)

Thank in advance!

[Update:] Apologies for any ambiguity: I need to get ALL the UserIds. But for each UserId, only that row where that user has the latest date.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle