当前位置:   article > 正文

sql异常Encountered unexpected token BINARY_encountered unexpected token: "binary" "binary

encountered unexpected token: "binary" "binary

1.出现错误

2023-11-06 10:48:19.604 [http-nio-8091-exec-3] WARN   c.b.m.e.p.i.PaginationInnerInterceptor - [autoCountSql,343] - [e322891e-de87-4d98-8456-f6448d3c165e] - optimize this sql to a count sql has exception, sql:"select
        s.id,
        s.command,
        s.category,
        s.service_uuid,
        s.org_code,
        sum(s.used_total) used_total,
        sum(s.used_success) used_success,
        sum(s.used_failed) used_failed,
        s.extend1,
        s.extend2,
        s.extend3,
        s.update_by,
        s.update_on,
        s.create_by,
        s.create_on
        from
         
       mytable_a
      s
        left join mytable_b c on s.command = c.command
         WHERE  s.org_code = ? 
        group by BINARY s.command", exception:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "BINARY" "BINARY"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

问题在 BINARY s.command 这里, 不符合标准语法, 使用替换即可

CAST(value AS BINARY) 
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/894192
推荐阅读
相关标签
  

闽ICP备14008679号