How do I escape % in Knex where like query?

后端 未结 6 1444
挽巷
挽巷 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:05

    Use the RLIKE instead of LIKE as below, It should work for you.

    function search(term){
        knex('table').where('description','rlike',term);
        ...
    }
    

提交回复
热议问题