select count(distinct( case when job_id>1 then ‘>1’ else ‘<=1’ end))as output from firstTable;
select count(case 分数字段 when 100 then 1 end) as [满分], count(case when 分数字段 between 90 and 99 then 1 end) as[90-99分], count(case when 分数字段 between 80 and 89 then 1 end) as[80-89分], count(case when 分数字段 between 70 and 79 then 1 end) as[70-79分], count(case when 分数字段<70 then 1 end) as[70分以下] from 学生分数表
| 如果主键不重复,则insert;如果主键重复,则update |
INSERT INTO cferr (ainf,apmd,aptp,aver,dver,ercd,icon,emsg,etil,type) VALUES (‘CS.BS.APP.API.11’,‘DEBUG’,1112102,0,1471528870155,40009,0,‘很抱歉,该地区暂未开通此项服务’,’‘,4) , (’CS.BS.APP.API.11’,‘DEBUG’,1112101,0,1471528870155,40009,0,‘很抱歉,该地区暂未开通此项服务’,’’,4) ON DUPLICATE KEY UPDATE emsg= VALUES(emsg); |
| 如果行作为新记录被插入,则受影响行的值显示1;如果原有的记录被更新,则受影响行的值显示2。 |
PreparedStatement
mysql>flush privileges;//刷新系统权限表