MySQL多個條件判斷是怎樣的呢?下面就為您舉例說明MySQL多個條件判斷,希望對您學習MySQL多個條件判斷方面能夠有所啟迪。
- use industry_finance;
- DELIMITER //
- drop procedure if exists updateCursor //
- CREATE PROCEDURE updateCursor()
- BEGIN
- declare id varchar(20);
- declare month varchar(20);
- declare season varchar(20);
- declare cur1 CURSOR FOR SELECT ID_,month_ FROM t_industry_finance_instance;
- OPEN cur1;
- FETCH cur1 INTO id,month;
- WHILE (id is not null ) DO
- if(month='01'||month='02'||month='03') THEN set season='1';
- end if;
- if(month='04'||month='05'||month='06') THEN set season='2';
- end if;
- if(month='07'||month='08'||month='09') THEN set season='3';
- end if;
- if(month='10'||month='11'||month='12') THEN set season='4';
- end if;
- update t_industry_finance_instance set seasonseason_=season where ID_=id;
- FETCH cur1 INTO id,month;
- END WHILE;
- CLOSE cur1;
- END;//
- DELIMITER ;
- call updateCursor();
MySQL replace函數替換字符串
MySQL字符串連接函數用法簡介
mysql查詢大小寫問題
教您如何實現MySQL全文查詢
MySQL查詢結果條數編號示例