关于mybatis条件查询 报错:元素内容必须由格式正确的字符数据或标记组成
原查询
select sum(case when age<=16 then 1 else 0 end ) age1,
sum(case when age>16 and age<=25 then 1 else 0 end ) age2,
sum(case when age>25 and age<=35 then 1 else 0 end ) age3,
sum(case when age>35 and age<=45 then 1 else 0 end ) age4,
sum(case when age>45 and age<=55 then 1 else 0 end ) age5,
sum(case when age>55 and age<=65 then 1 else 0 end ) age6,
sum(case when age>65 and age<=75 then 1 else 0 end ) age7,
sum(case when age>75 then 1 else 0 end ) age8,
count(id) other
from snap_face
经检查发现xml格式 <=号无法正确识别
改过之后的查询
select sum(case when age <=16 then 1 else 0 end ) age1,
sum(case when age>16 and age <=25 then 1 else 0 end ) age2,
sum(case when age>25 and age <=35 then 1 else 0 end ) age3,
sum(case when age>35 and age <=45 then 1 else 0 end ) age4,
sum(case when age>45 and age <=55 then 1 else 0 end ) age5,
sum(case when age>55 and age <=65 then 1 else 0 end ) age6,
sum(case when age>65 and age <=75 then 1 else 0 end ) age7,
sum(case when age>75 then 1 else 0 end ) age8,
count(id) other
from snap_face
- 附:XML转义字符
<< 小于号;
>> 大于号;
& & 和 ;
' ‘’单引号;
" “” 双引号;
最新文章
- ios枚举规范
- B/S网站中IE6兼容问题
- 利用substring()方法,把一个表的不同分级所对应的字段名取出来。
- 弄清UTF8和Unicode
- Effective Java 10 Always override toString() method
- 放到u-boot/arch/arm/inlcude下面解压A20固件库制作笔记
- MySQL DELETE 表别名问题
- 【Delphi】圆角窗体
- [转载]C#时间函数
- tomcat内存溢出,改动设置
- 201521123072《java程序设计》第十二周学习总结
- Spring AOP分析(2) -- JdkDynamicAopProxy实现AOP
- Numpy入门 - 数组基本运算
- 会话机器人Chatbot的相关资料
- 如何接入银联“快速接入”产品API
- 发送http请求,get和post两种请求方式
- UE4随笔(一)准备过程
- am335x 10.1";电容touch 不能识别
- [Virtualization] Virtualbox 转换磁盘格式(vboxmanage) disk to VMware
- 洛谷P2661 信息传递
热门文章
- 使用abcpdf分页设置的问题
- 调研一类软件的发展演变( 1000-2000 words, in Chinese)
- Axure环境安装,组件引入,使用示例
- 大数据与云计算的关系是什么,Hadoop又如何参与其中?Nosql在什么位置,与BI又有什么关系?
- SDL 开发实战(五): SDL 纹理渲染
- Hadoop伪分布式配置
- [Swift]LeetCode225. 用队列实现栈 | Implement Stack using Queues
- ubuntu 16.04 更改默认Python版本
- JSON 序列化的时候忽略无效的属性值
- 网络协议 9 - TCP协议(下):聪明反被聪明误