使用IF...ELSE语句判断日期是否为周日
小朋友作业操碎心,看代码:
use test;
delimiter $$
create procedure pre12()
BEGIN
declare issunday int;
declare datastrtest varchar(255);
declare i int;
set i=1;
while i<3 do
SELECT datastrinner, days into datastrtest,issunday FROM (SELECT datastr as datastrinner ,DAYOFWEEK(datastr) AS days FROM test.test_week where id=i) tmp;
if issunday = 1 then
select datastrtest,issunday,"是" as "是否为周日";
else
select datastrtest,issunday,"不是" as "是否为周日";
end if;
set i=i+1;
end while;
END
$$
call pre12();
以上是 使用IF...ELSE语句判断日期是否为周日 的全部内容, 来源链接: utcz.com/z/531396.html