zoukankan      html  css  js  c++  java
  • 关于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转义字符

    << 小于号;

    >> 大于号;

    & & 和 ;

    ' ‘’单引号;

    " “” 双引号;

  • 相关阅读:
    HTTP网页错误代码大全带解释
    记录一下手把手教您做电商网站
    C#中的Attribute
    C#中dynamic的正确用法
    【CSP】最大的矩形
    【CSP】字符与int
    C++数组初始化
    C++中输出字符到文本文档
    C++ 中时钟函数的使用
    各种函数的头文件
  • 原文地址:https://www.cnblogs.com/lancelee98/p/9879116.html
Copyright © 2011-2022 走看看