// Figure out what we're sorting by, and add associated WHERE clauses.
// MySQL's query planner screws up if we include a field in ORDER BY
// Figure out what we're sorting by, and add associated WHERE clauses.
// MySQL's query planner screws up if we include a field in ORDER BY