Utkarsh Sharma Utkarsh Sharma - 1 month ago 4x
MySQL Question

how to fetch random stores name but price in ascending order from database?

how to use fetch 'food_store' order by randomly and price order by ASC ?
write now i am using this query

Select * from `food` where `veg_non` = 'Veg' and `food_price` <= ? ORDER BY RAND()


Try this:

Select *, RAND() as r from `food` where `veg_non` = 'Veg'
    and `food_price` <= ? ORDER BY `food_price` ASC, r ASC