title: How to query for all users that belong to a trip given a list of trips?
body: <p>I have 3 tables:</p>
  
  <p><code>trips [id, name, ...]</code></p>
  
  <p><code>users [id, first_name, last_name, ... ]</code></p>
  
  <p><code>trips_users [trip_id, user_id]</code></p>
  
  <p>I already have a filtered list of trips but now I am trying to get the users that are on each trip.</p>
  
  <p>When I search for just one trip and its corresponding users, I use a INNER JOIN and that's not so bad.</p>
  
  <p>But when I search for a list of trips and get a filtered list, I am having some trouble figuring out how I can write a query to get just the users that are on the trips I got previously.</p>
  
  <p>So,</p>
  
  <p>I am first doing something like this -</p>
  
  <pre><code>SELECT id, name, ...
  FROM trips
  WHERE &lt;some filters&gt;
  </code></pre>
  
  <p>This gives me a list of trips.  Now, I need to associate a list of users that were on that trip, so how can I do that in one go?</p>
  
  <p>Or do I need to iterate through my list of trips and just run the inner join query on each one?  </p>
  
  <p>I tried using a RIGHT JOIN but that gives me hella rows which is bad right?</p>
  
  <p>Thanks</p>