久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

mysql的循環語句問題

瀏覽:153日期:2022-06-17 14:17:39

問題描述

要多次的執行一個select操作,就想著用循環來實現,在網上查了一些內容,顯示的做法都是差不多的,就是總是提示語言錯誤,很是郁悶,各位大俠幫忙看看,要怎么改才可以。mysql數據庫、navicat客戶端。mysql循環的操作語句:

procedure pro10()begindeclare i int; set i=0; while i<5 do select * from gamechannel where status=i GROUP BY gameId ; set i=i+1; end while;end;

錯誤信息:[SQL] procedure pro10()begindeclare i int;[Err] 1064 - 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 ’procedure pro10()begindeclare i int’ at line 1

問題解答

回答1:

你這是再寫存儲過程嗎?1.創建存儲過程DELIMITER $$create procedure pro10()begindeclare i int; set i=0; while i<5 do

select * from gamechannel where status=i GROUP BY gameId ; set i=i+1;

end while;end;$$

2.調用call pro10()

相關文章:
主站蜘蛛池模板: 汉沽区| 博罗县| 丘北县| 班玛县| 东至县| 潜江市| 贵州省| 井陉县| 阿图什市| 拉萨市| 仁化县| 平舆县| 讷河市| 渭源县| 秭归县| 苍溪县| 兰西县| 巴南区| 鄂尔多斯市| 灯塔市| 名山县| 马公市| 大石桥市| 云南省| 博乐市| 徐水县| 白城市| 常山县| 肥东县| 英山县| 莲花县| 田东县| 凤翔县| 芦山县| 登封市| 巴林左旗| 平泉县| 上蔡县| 霞浦县| 吉木乃县| 清新县|