CASE value WHEN [compare-value] THEN result [WHEN
[compare-value] THEN result ...] [ELSE result] END CASE WHEN [condition]
THEN result [WHEN [condition] THEN result ...] [ELSE result] END
例:
mysql>SELECT IF(1<2,'yes ','no')
->'yes'
mysql中定义一个成绩变量,if判断等级参考以下方法代码如下:php语言
var $score//分数变量
if($score<60){
echo "不及格"
}elseif($score<69 &&$score>=60){
echo "及格"
}else if($score>=70 &&$score<80){
echo "中"
}else if($score>=80 &&$score<90){
echo "良"
}else{
echo "优"
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)