Selects only the latest status update for each user for twitter-like web application.

SQL Test:
Imagine you have a User table for a twitter-like web application that looks like this: Username, Status Update, Date Updated (eg. Ann123, "Hi, I am at Startbucks!", 01/26/12 10:00:01). Write a query that selects only the latest status update for each user.
Selects only the latest status update for each user.


Here's the closest answer to above quiz:



SELECT *

FROM (

SELECT *

FROM `user`

ORDER BY username, DateUpdated DESC

) AS u

GROUP BY username



I believe you can find the better answer to this. Thanks
Credit goes to Tony.

Popular posts from this blog

npm refusing to install as a dependency of itself

How to call javascript functions from VB.NET and using WebBrowser Control