I have a database table in SQLite that contains information about employees
Table Name: Employee
ID Name Country CountyID Status
1 John IN 1 Active
2 Jack US 1 InActive
3 Emma UK 1 Active
4 Josh US 1 Active
5 Jill US 0 Active
I am looking to retrieve the details of employees who are currently 'Active' and reside in either 'IN' or 'US', or have a CountyID of '1'
Sample Code:
const dbContext = require("knex")({
client: "sqlite3",
connection: {
filename: filename.db
},
useNullAsDefault: true
});
const persons = dbContext('Employee').where({Status: 'Active'}). ???
SQL Query is
SELECT * FROM Employee WHERE Status = 'Active' AND (Country IN ('IN', 'US') OR CountyID = 1)
I need the equivalent Knex Query. Can someone please help me with this?