[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
解決MySQL報(bào)錯(cuò):1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat
?
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c
轉(zhuǎn)載WxyangID?發(fā)布于2018-05-11 19:11:43?閱讀數(shù) 2486??收藏
展開
在navicat for mysql中的查詢編輯器中執(zhí)行sql語句總是提示下面的錯(cuò)誤,雖然也可以正確的執(zhí)行,但是看著總有些不對勁,所以就在csdn上查找了解決方案:已驗(yàn)證此解法可以有效。
解決方法:
主要是因?yàn)閟ql_mode設(shè)置導(dǎo)致的這個(gè)錯(cuò)誤。
在新建查詢中執(zhí)行如下命令:
-- 查看sql_mode設(shè)置
show variables like "sql_mode";
-- 設(shè)置sql_mode
set sql_mode='';
set sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';
結(jié)果證明該方案有效;
?
也可以參考博主的另一個(gè)方法,設(shè)置mysql中的my.ini文件。
?
參考:https://blog.csdn.net/zq33312757/article/details/53118459
?
*******************************************************************************************************************
選中數(shù)據(jù)庫
?-- 查看sql_mode設(shè)置 ?
?show variables like "sql_mode"; ?
?-- 設(shè)置sql_mode ?
?set sql_mode=''; ??
?set sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';
create table `product_info`(
?? ?`product_id` varchar(32) not null comment '商品id',
?? ?`product_name` varchar(64) not null comment '商品名稱',
?? ?`product_price` decimal(8,2) not null comment '單價(jià)',
?? ?`product_stock` int not null comment '庫存',
?? ?`procuct_description` ?varchar(64) ?comment ?'描述',
?? ?`product_icon` varchar(512) comment '小圖',
?? ?`procuct_type` int not null comment '類目編號',
?? ?`create_time` timestamp not null default current_timestamp comment '創(chuàng)建時(shí)間',
? ?primary key (`product_id`) # 這里不是單引號怪不得寫不出來 報(bào)錯(cuò)
)comment '商品表'
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 微信支付师兄
- 下一篇: 下载bilibli网站视频