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转义字符

    << 小于号;

    >> 大于号;

    & & 和 ;

    ' ‘’单引号;

    " “” 双引号;

  • 相关阅读:
    树状数组——求和问题题解
    java 基础01
    java jdk 配置
    一位资深程序员大牛给予Java初学者的学习路线建议
    汇编 OD 标志位 置位相关指令
    汇编 SETG,SETL ,SETGE, SETLE指令
    汇编 指令lodsb,lodsw,lodsd
    汇编 STOSB, STOSW, STOSD指令
    汇编 LOOP,LOOPD指令
    汇编 STD和CLD指令
  • 原文地址:https://www.cnblogs.com/lancelee98/p/9879116.html
Copyright © 2011-2022 走看看