【发布时间】:2019-02-08 02:23:43
【问题描述】:
我浏览了 knex 文档,并尝试了所有可能的组合,但没有成功。但是,使用 SQLiteStudio,我能够成功使用多个常规查询 ?...
select * from 'articles' where LOWER("cover_page") = ? AND "cover_page" != "" AND "user_id" = ?
select * from 'articles' where LOWER("title") = ? AND "title" != "" AND "user_id" = ?
select * from 'articles' where LOWER("link") = ? AND "link" != "" AND "user_id" = ?
...在 knex 中,如果我一次只使用 1 个 ?,我能够获得以下成功:
const doesExist = await db('articles')
.where(db.raw('LOWER("cover_page") = ?', article.cover_page.toLowerCase()))
.orWhere(db.raw('LOWER("title") = ?', article.title.toLowerCase()))
.orWhere(db.raw('LOWER("link") = ?', article.link.toLowerCase()))
.first();
有谁知道如何输入AND "user_id" = ? 的第二个值??
目标是输出什么都不返回...
【问题讨论】: