Sort by lowest price in a Mysql table

2

How to list products that have the lowest price for the largest!

From lowest to highest! Using PHP and Mysql.

    
asked by anonymous 17.04.2015 / 22:36

1 answer

2

Just add this code to the end of your select :

ORDER BY 'preco' Asc

In this case, you use ASC to sort ascending and DESC to sort descendingly.

A% complete% would look like this:

SELECT * FROM 'produtos' ORDER BY 'preco' Asc

You can see an example using select in this link.

Here's an example in SqlFiddle: Example here

    
17.04.2015 / 22:53