taozhi8833998 / node-sql-parser

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL
https://taozhi8833998.github.io/node-sql-parser/
Apache License 2.0
798 stars 180 forks source link

some function parse error #1897

Closed whg001 closed 4 months ago

whg001 commented 5 months ago

Can you help me solve these situations? mysql

## sum(b.f_helpful=2) 
select a.*,sum(b.f_hits_number) hits,sum(b.f_helpful=1) helpful from t_xxxx a left join t_bbb b on a.f_id = b.question_name_id group by a.f_id

### like "\tH20190022%"
 SELECT d.Fdrug_hash_id FROM t_xxxx d where  d.Fapproval_number like "      H20190022%"
taozhi8833998 commented 4 months ago

@whg001 fixed sum(b.f_helpful=2) error in the first case. You should escape \t for the second case

SELECT d.Fdrug_hash_id FROM t_xxxx d where  d.Fapproval_number like "\\tH20190022%"

or

SELECT d.Fdrug_hash_id FROM t_xxxx d where  d.Fapproval_number like '\tH20190022%'