I’m running a query that gets users with a certain age. E.G AGE <= 5
So the query gets these rows:
Country | Age
US 5
US 20
AR 3
ES 5
US 2
The problem is that to remain relevant I want to display the results matching the user’s country first, using US as an example it should be like this:
Country | Age
US 2
US 5
US 20
US 2
AR 3
ES 5
I know how to do this with two queries, first getting US results and then the rest and order all by age but I wanted to know if it’s possible to get results ordered with just one query.
You could use an ORDER BY like this:
That would put US first and then the rest would come after and be sorted by
country.