HOW TO USE ORDER BY WITH THE QUERY FUNCTION