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=…?
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.