Slight change in SQL query to allow for order