• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

Newest Record from each user in table?

I have a table that is layed out like this:

TableName
          id
          timestamp
          login
          data

I need to get the newest data for each user. But I can't get duplicates per user.

How would I formulate that query?

Thanks
0
cybertrickle
Asked:
cybertrickle
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
select t.*
from tablename t
where t.timestamp = ( select max(i.timestamp) from tablename i where i.login = t.login )
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now