关于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转义字符
<< 小于号;
>> 大于号;
& & 和 ;
' ‘’单引号;
" “” 双引号;
关于mybatis条件查询 报错:元素内容必须由格式正确的字符数据或标记组成的更多相关文章
- MyBatis异常:元素内容必须由格式正确的字符数据或标记组成
今天在写接口查询SQL时,报了一个异常,如下: Cause: org.apache.ibatis.builder.BuilderException: Error creating document i ...
- Mybatis 元素内容必须由格式正确的字符数据或标记组成
一个web应用,框架为SpringMVC Spring Mybatis ,昨天写了一下午的代码,因为逻辑较大,期间也没测,打算写完这个功能点在进行测试,谁知道写完的时候,tomcat根本启动不起来了, ...
- mybatis异常 :元素内容必须由格式正确的字符数据或标记组成。
今天同事写一个查询接口的时候,出错:元素内容必须由格式正确的字符数据或标记组成. 错误原因:mybatis查询的时候,需要用到运算符 小于号:< 和 大于号: >,在mybatis配置文 ...
- 关于MyBatis一些小错误,元素内容必须由格式正确的字符数据或标记组成.
今天在Mapper.xml文件写查询语句报了个奇怪的错误 Caused by: org.apache.ibatis.builder.BuilderException: Error creating d ...
- Cause: org.xml.sax.SAXParseException; lineNumber: 45; columnNumber: 62; 元素内容必须由格式正确的字符数据或标记组成。
三月 09, 2018 12:13:39 下午 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending ...
- org.xml.sax.SAXParseException: 元素内容必须由格式正确的字符数据或标记组成,的错误问题
当时在mapper其中的一个语句是case when ISNULL(b.c_truename) || LENGTH(TRIM(b.c_truename)) < 1 then b.c_ch_nam ...
- 【mybatis】【mysql】mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains no ...
- 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'
mybatis查询报错: Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for pro ...
- myBatis查询报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
myBatis查询报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL se ...
随机推荐
- For each...in / For...in / For...of 的解释与例子
1.For each...in for each...in 语句在对象属性的所有值上迭代指定的变量.对于每个不同的属性,执行一个指定的语句. 语法: for each (variable in obj ...
- Java构造方法、成员变量初始化以及静态成员变量初始化三者的先后顺序是什么样的?
[Java笔试真题]:构造方法.成员变量初始化以及静态成员变量初始化三者的先后顺序是什么样的? [解答]:当类第一次被加载的时候,静态变量会首先初始化,接着编译器会把实例变量初始化为默认值,然后执行构 ...
- FFmpeg 结构体学习(四): AVFrame 分析
在上文FFmpeg 结构体学习(三): AVPacket 分析我们学习了AVPacket结构体的相关内容.本文,我们将讲述一下AVFrame. AVFrame是包含码流参数较多的结构体.下面我们来分析 ...
- [Swift]LeetCode186. 翻转字符串中的单词 II $ Reverse Words in a String II
Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...
- [Swift]LeetCode328. 奇偶链表 | Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note her ...
- 开发常用的 Android 函数库
第三方函数库(译者注:包括第三方提供的 SDK,开源函数库)以惊人的方式助力着 Android 开发,借助这些其他开发人员辛勤工作的成果,我们开发起来更轻松和快捷.目前存在成千上万的函数库,如何选择正 ...
- linux终端文本编辑神器vi的使用
vi —— 终端中的编辑器 目标 vi 简介 打开和新建文件 三种工作模式 常用命令 分屏命令 常用命令速查图 01. vi 简介 1.1 学习 vi 的目的 在工作中,要对 服务器 上的文件进行 简 ...
- BBS论坛(四)
4.1.cms登录页面csrf保护 (1)Perfect_bbs.py from flask_wtf import CSRFProtect CSRFProtect(app) 添加csrf保护后,现在再 ...
- Docker 下载镜像
文章首发个人网站: https://www.exception.site/docker/docker-pull-image 本文中,我们将需要学习 Docker 如何下载镜像? 一.前言 大家都知道, ...
- Java接口的实例应用:致敬我的偶像——何塞·穆里尼奥
文/沉默王二 曹操在<短歌行>中为杜康酒打过一个价值一亿个亿的广告——“何以解忧,唯有杜康”,我替曹操感到惋惜的是他本人并不会收到这笔不菲的代言费.想一想,要是三国时期的明星人物们有这个代 ...