ARISGames/server — pull request #3 by mtolly (2014-09-16 17:16:55+00:00)
Title: Split up sort SQL to ensure the query is valid

This should fix the broken search and sort functionality on Siftr.

The query can end up having `JOIN`, `WHERE`, and `GROUP`/`ORDER`, and they need to come in that order. A few of the existing search fragments needed to be split up in order to ensure that happens.