Sort query results according to lowest or highest price

Hi everyone,

I’m fetching some data from a MySQL database. One of my columns “prices_from” includes the prices of the products I’m displaying. The type is decimal(6,2). How can I sort the query results according to lowest or highest price? I have heard of the MIN() and MAX() functions but how do I use these in the WHERE part of the query?
WHERE car=”BMW” && prices_from=…?

Thank you for your help.

Try appending “ORDER BY prices_from;” to your SQL statement.

Hi there John,

thanks for the info. Will try it out.


By default the list will be in ascending order, so lowest first. To reverse this to highest first or descending, add “DESC” to the end of the query after the column name.

SELECT * FROM tablename ORDER BY prices_from DESC

Thanks SamA74.