通过不在我的sql中工作来订购

laawzig2  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(223)
order by no_of_products desc;

为什么上面的代码有效而下面的代码无效。我应该怎么做才能使下面的代码正常工作。

order by no_of_products sold desc;

或者

order by no_of_products sold' desc;
qoefvg9y

qoefvg9y1#

似乎缺少order by列之间的分隔符

order by no_of_products desc, sold desc;

(或在错误的位置使用别名)
或者如果你有一列空格,使用backtics

order by `no_of_products sold` desc;

但我建议你不要用带空格的列名。。

相关问题