0

I have a MySQL table like this:

id | num | name
1  | 102 | name 1
2  | 102 | name 2
3  | 102 | name 3
4  | 103 | name 4
5  | 103 | name 5
6  | 103 | name 6
7  | 103 | name 7

I want to know how its possible to get the latest "num" values (sorted by ID column), so the output should look like:

id | num | name
3  | 102 | name 3
7  | 103 | name 7

Without the rest of the rows in this table.

3
  • You have tagged [php]. If that is the query language you are using, it is off topic here. You need to improve the quality of your post so it can be migrated to the proper site. You need to share what you have already tried to and give examples of your code so people don't think you are looking for a free coding service.
    – CharlieRB
    Oct 6, 2017 at 19:59
  • You say "Without the rest of the columns in this table." You mean "Without the rest of the rows in this table," right? Oct 7, 2017 at 8:50
  • 1
    Probably a combination of GROUP BY and MAX().
    – Seth
    Oct 7, 2017 at 8:57

0

You must log in to answer this question.

Browse other questions tagged .