sql improvements in releases.php

mysql isn't great at dealing with IN(SELECT...) so i've rewritten the ones in releases.php to use joins instead