gpt4 book ai didi

mysql - 可以对 DISTINCT mysqli 查询进行排序吗?

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

我用这个查询我的数据库:

SELECT DISTINCT type FROM drinks ORDER BY order ASC

我收到此错误消息:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order ASC' at line 1

绝对是 ORDER BY order ASC 打破了它。

最佳答案

使用这个

SELECT DISTINCT type FROM drinks ORDER BY `order` ASC

你也可以用这个

SELECT DISTINCT d.type FROM drinks AS d ORDER BY d.order ASC

关于mysql - 可以对 DISTINCT mysqli 查询进行排序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15267799/

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