I have a teams table and a players table and I’m wanting to find all teams that do not have players associated with them. The players table is associated via a team_id column. I’m using Ruby on Rails for this so I have a Team and a Player model.
I have a teams table and a players table and I’m wanting to find
Share
It may perform better doing a left join:
Or using ARel (thanks to JasonKing’s comment):