i'm trying to sort a query by two conditionals. First query is if the 'percentage' is above 75 and if it's not it will then sort by a 'grade' The percentage belongs in a another table than the grade. for example, the first query could look something like this but would only be for values above '75:
joins(:school_annual_data => :school_eligibility_data).order("GREATEST(school_annual_data.survey3_low_percent, school_eligibility_data.low_income_percent)")
Then the query would look like:
order('school_type ASC')
How can I combine them together?