title: I want duplicates to be included with my in () statement
body: <p>I want to include duplicates into my query. I havent succeeded in changing my "in" statements to "joins".</p>
  
  <p>My expected result is a row count of 115.</p>
  
  <p>My result is a row count of 108.</p>
  
  <p>If i do a "Group by" in my first subquery, i get a row count of 108.</p>
  
  <pre><code>select match_id item_0, item_1,  item_2, item_3, item_4, item_5, purchase_log 
      from player_matches where match_id IN
         (select x.match_id from (select matches.match_id, picks_bans.team from matches, picks_bans where picks_bans.hero_id = 1 and picks_bans.match_id = matches.match_id and is_pick = true and start_time &gt; 1483228800 ORDER BY start_time DESC) as x 
          inner join
               (select matches.match_id, picks_bans.team from matches, picks_bans where picks_bans.hero_id 
  /*this is the statement that needs to be tweaked/changed */
                 IN (2,12,47,4,99) and picks_bans.match_id = matches.match_id and is_pick = true and start_time &gt; 1483228800 ORDER BY start_time DESC) as y  on y.match_id=x.match_id and x.team!=y.team) 
      and hero_id = 1
  </code></pre>
  
  <p>You can use the opendota inbrowser data-explorer to get a better understanding of my problem.</p>
  
  <p><a href="https://www.opendota.com/explorer?sql=select%20x.match_id%20from%20(select%20matches.match_id%2C%20picks_bans.team%20from%20matches%2C%20picks_bans%20where%20picks_bans.hero_id%20%3D%201%20and%20picks_bans.match_id%20%3D%20matches.match_id%20and%20is_pick%20%3D%20true%20and%20start_time%20%3E%201483228800%20ORDER%20BY%20start_time%20DESC)%20as%20x%20%20inner%20join%20(select%20matches.match_id%2C%20picks_bans.team%20from%20matches%2C%20picks_bans%20where%20picks_bans.hero_id%20in%20(2%2C12%2C47%2C4%2C5)%20and%20picks_bans.match_id%20%3D%20matches.match_id%20and%20is_pick%20%3D%20true%20and%20start_time%20%3E%201483228800%20ORDER%20BY%20start_time%20DESC)%20as%20y%20%20on%20y.match_id%3Dx.match_id%20and%20x.team!%3Dy.team&amp;format=table" rel="nofollow noreferrer">My subquery (returns 115)</a> </p>
  
  <p><a href="https://www.opendota.com/explorer?sql=select%20match_id%20item_0%2C%20item_1%2C%20%20item_2%2C%20item_3%2C%20item_4%2C%20item_5%2C%20purchase_log%20from%20player_matches%20where%20match_id%20IN%20(select%20x.match_id%20from%20(select%20matches.match_id%2C%20picks_bans.team%20from%20matches%2C%20picks_bans%20where%20picks_bans.hero_id%20%3D%201%20and%20picks_bans.match_id%20%3D%20matches.match_id%20and%20is_pick%20%3D%20true%20and%20start_time%20%3E%201483228800%20ORDER%20BY%20start_time%20DESC)%20as%20x%20%20inner%20join%20(select%20matches.match_id%2C%20picks_bans.team%20from%20matches%2C%20picks_bans%20where%20picks_bans.hero_id%20in%20(2%2C12%2C47%2C4%2C5)%20and%20picks_bans.match_id%20%3D%20matches.match_id%20and%20is_pick%20%3D%20true%20and%20start_time%20%3E%201483228800%20ORDER%20BY%20start_time%20DESC)%20as%20y%20%20on%20y.match_id%3Dx.match_id%20and%20x.team!%3Dy.team)%20and%20hero_id%20%3D%201&amp;format=table" rel="nofollow noreferrer">My final Query (returns 108)</a></p>
  
  <p><strong>How do i get my final query to return 115 row counts?</strong></p>
  
  <p>My query is also really slow, is this because im using "in ()"? </p>