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()
最佳答案
试试这个:
Select *, RAND() as r from `food` where `veg_non` = 'Veg'
and `food_price` <= ? ORDER BY `food_price` ASC, r ASC
关于mysql - 如何从数据库中按升序获取随机商店名称和价格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39335400/