LEFT JOIN only first row

If you can assume that artist IDs increment over time, then the MIN(artist_id) will be the earliest.

So try something like this (untested…)

SELECT *
  FROM feeds f
  LEFT JOIN artists a ON a.artist_id = (
    SELECT
      MIN(fa.artist_id) a_id
    FROM feeds_artists fa 
    WHERE fa.feed_id = f.feed_id
  ) a

Leave a Comment