Skip to content

NOT NULL查询


whereIsNotNull()

可通过链式调用的方式来指定多条件的查询

  • @param field 字段名

whereIsNotNull()

import { Db } from 'think-ts-db'
export default defineEventHandler(async (event) => {
    const user = await Db('user', mysqlConfig).where('age', 10).whereIsNotNull('score').select()
    return user
})
import { Db } from 'think-ts-db'
export default defineEventHandler(async (event) => {
    const user = await Db('user', mysqlConfig).where('age', 10).whereIsNotNull('score').select()
    return user
})

最终的SQL语句为:

SELECT * FROM user WHERE age = 10 AND score IS NOT NULL
SELECT * FROM user WHERE age = 10 AND score IS NOT NULL

备案号:冀ICP备20015584号-2