gpt4 book ai didi

php - mysql 改变表顺序不工作

转载 作者:行者123 更新时间:2023-11-29 13:07:20 26 4
gpt4 key购买 nike

我在网上搜索了很多。我能理解的是,在我之前很多人都遇到过这个问题,并且它也被归档为 mysql bug。但我找不到任何解决方案。问题是我无法让这个命令工作-

alter table areas order by area_name;

我收到此警告-

ORDER BY ignored as there is a user-defined clustered index in the table 'areas'

我只想根据“area_name”(即区域名称)对表格进行排序。只是补充一下,我正在尝试在我的 laravel 应用程序 的数据库中执行此操作。

最佳答案

如果数据库引擎是InnoDB,那么你不能这样做。

From the doc:

ORDER BY does not make sense for InnoDB tables because InnoDB always orders table rows according to the clustered index.

关于php - mysql 改变表顺序不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22526687/

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