MYSQL distinct query

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-21T15:05:05Z Indexed on 2010/03/21 15:11 UTC
Read the original article Hit count: 262

Filed under:
|

This is my example of my table:

id | name | foreign_id |

1 a 100

2 b 100

3 c 100

4 a 101

5 b 101

6 c 101

I would like to get the distinct file with the latest foreign_id (bigger number). In this example, it would be row with id 4,5,6. Anyone has any idea? Thank you very much!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about distinct