lundi 5 juin 2017

MySQL, PHP - Select row with highest percentage drop of price

I didn't find any similar questions/ answers about my problem yet, so please bare with me:

I need a MSQL query to run in PHP wich can do the folowing: Get just one row (all columns) that has the highest procentage drop between the columns 'old price', 'price' (current price). ex: old_price = 204.99 price = 129.99 (36.5% decrease)

I want to display only an article via PHP mysqli_fetch_assoc wich has the highest percentage decrease, also i would like to save the percentage in a variabile. Thanks!




Aucun commentaire:

Enregistrer un commentaire