Skip to content
Advertisement

How to select only latest added records avoiding duplicates

I need to select from the table competition_rounds the latest added records which are linked to the competition_seasons table with the season_id column, eg:

competition_rounds

competition_seasons

I want return only:

the problem’s that my query return all rounds available:

NB: The table competition simply contains a list of competition references.

Advertisement

Answer

If I understand correctly, you can use a subquery to return only the latest season from the seasons table:

Your question only mentions two tables, although the query has three. This is only based on the question.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement