gpt4 book ai didi

mysql - 如何从数据库中按升序获取随机商店名称和价格?

转载 作者:行者123 更新时间:2023-11-29 07:12:01 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com