范围查询
whereBetween()
可通过链式调用的方式来指定多条件的查询
- @param
field
字段名 - @param
value1
值1 - @param
value2
值2 - (field: string, value1: string | number, value2: string | number)
whereBetween()
Db('user').where('age', 10).whereBetween('score', 60, 80).select()
Db('user').where('age', 10).whereBetween('score', 60, 80).select()
最终的SQL语句为:
SELECT * FROM user WHERE age = 10 AND score BETWEEN 60 AND 80
SELECT * FROM user WHERE age = 10 AND score BETWEEN 60 AND 80