How do I escape % in Knex where like query?

后端 未结 6 1442
挽巷
挽巷 2021-01-18 00:09

I\'m using knex to generate my SQL queries. In knex documentation, it shows this

knex(\'users\').where(\'columnName\', \'like\', \'         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 01:03

    Hey have you tried this

    knex('Quotes').where('quoteBody', 'like', **'%'+Quote+'%'**)
    
    

    just the regular javascript escaping works just fine.

提交回复
热议问题