Fixes MySQL Creating Temporary Tables Bug

MySQL has what many consider to be a bug when using an IN clause in a query where. After a certain point, it puts these results in a temp table instead of using more optimized methods of joining the tables together. This can adversely affect performance if the temp table ends up on disk.

In this case the query ended up in a temp table 80 / 100 times, 3 of which it's ended up on disk for.
![image](https://cloud.githubusercontent.com/assets/1292766/3925321/559bb8d4-23e6-11e4-970d-0b754d433c4d.png)

Simple fix is to switch these over to use inner joins / group by's in order to achieve the most optimal result.
![image](https://cloud.githubusercontent.com/assets/1292766/3925337/83b3db98-23e6-11e4-8a1b-386005f58f88.png)

Same results, more consistent performance.