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

    << 小于号;

    >> 大于号;

    & & 和 ;

    ' ‘’单引号;

    " “” 双引号;

  • 相关阅读:
    Liquid模板语言参考文档
    Shopify主题title/description等SEO设置
    23个Shopify免费模板值得拥有
    navicate 激活
    idea 内存溢出
    mysql for update 使用说明
    quartz-SimpleSemaphore
    达梦数据库冷备份还原的简单记录
    Beyond Compare 的比较以及导出的简单设置方法
    PG13 离线安装的简单办法
  • 原文地址:https://www.cnblogs.com/lancelee98/p/9879116.html
Copyright © 2011-2022 走看看