Comments (6)
Database Exception – yii\db\Exception
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'yii2admin.yii2_menu.sort' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The SQL being executed was: SELECT group
FROM yii2_menu
WHERE (pid
='68') AND (hide
=0) GROUP BY group
ORDER BY sort
Error Info: Array
(
[0] => 42000
[1] => 1055
[2] => Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'yii2admin.yii2_menu.sort' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
)
from yii2admin.
是安装后就出现这个错误,还是修改了某些内容后导致的这个错误?可否重现?
from yii2admin.
可以重现,是mysql查询语句的问题,Group 与 Order 共同存在时,有的查询模式需要Group强制包含Order表达式所含字段,加上即可
from yii2admin.
这条sql语句确实写的不标准,only_full_group_by模式下会有sort不明确导致的问题,谢谢指正。
不过我更倾向于这个,mysql5.5不知道怎么开启这个模式,没有测试,不知道对不对。
$groups = static::find()->select(['group','min(sort) as sort']) ->where(['pid'=>$item['id'], 'hide'=>0]) ->groupBy(['sort','group'])->orderBy('sortASC')->asArray()->column();
from yii2admin.
$groups = static::find()->select(['group','min(sort) as sort']) ->where(['pid'=>$item['id'], 'hide'=>0]) ->groupBy(['group'])->orderBy('sortASC')->asArray()->column();
from yii2admin.
多向你学习
from yii2admin.
Related Issues (20)
- 百度编辑器的上传报错 HOT 2
- 请问有没有纯api接口的项目 HOT 1
- 样式和js为啥后台找不到 HOT 1
- 为啥要移除 init脚本呢
- 根本用不了,没有vendor HOT 1
- apache配置问题
- 在后台登录之后访问前台,/frontend/models/user 不存在
- composer安装出错 HOT 2
- 列表页的index.php 多层级的时候不刷新解决办法
- Unable to determine the path info of the current request.
- 确实autoloader.php 以及缺少htmlpurifier缺少文件
- 全站包怎么配置数据库并安装数据库
- 全站打包,安装后访问/admin报错 HOT 2
- composer install 为什么不能拉,我觉得这个要详细告知下哈 ,完整包这样不利于扩展哈
- 安装后访问出现错误 HOT 3
- 安装时报错,执行composer update 提示没有包 HOT 11
- 哈哈 哥们可以把前端模板给我一份儿么? HOT 24
- 关于项目rule规则 HOT 1
- 新建立应用主体怎么建立 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2admin.