Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2016
    Posts
    1

    Question Unanswered: Latest record grouped by user_id

    Hello, I've googled this and tried to get this to work and keep getting errors.

    My DB looks like this. Table name vexperts (id, ts, user_id) a few more fields after but the most important ones I listed.


    I have users that have duplicate records. User Steve may have 10 records but I'm looking to pull his latest based on ts(time stamp) and grouped by user_id. I want to query the latest record for each individual user.

    Thanks for the help and I've spent hours trying to understand this. I
    m a PHP guy and just ok at MYSQL.

    Thanks in advance.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Have a look at the select using a group by and limit clauses
    https://www.google.co.uk/search?q=my...limit+group+by

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •