I've been trying to get the proper data for this 4-table join for awhile and I can't seem to pin it down. I'm trying to grab a list of ids from
songs based on who I am following in
follows, and show the song id if my followers are the
creator of the track or just reshared it.
SELECT DISTINCT songs.id FROM songs LEFT JOIN follows ON follows.follower = 6 LEFT JOIN tracks ON tracks.creator = follows.following LEFT JOIN reshares ON reshares.resharer = follows.following WHERE songs.id = tracks.containing_song OR songs.id = reshares.song ORDER BY songs.last_updated DESC LIMIT 1
I'm not quite sure what's wrong, but my knowledge is very limited when it comes to database joins.