I'm trying to make query like:
"SELECT * ... WHERE deleted <> 1"
I found one solution:
.whereRaw("deleted <> ?", [1]);
But can I use .where (.whereNot) methods for this ?
Thank you
<> and != both mean not equal, and != is an alias for the standard <> operator.
!= may not exist in old version of MySQL, but normally you have no need to pay attention to this, as for knex documentation, it's just an example which tried to explain knex.raw...
whereNot is OK.
You can use directly knex.js whereNot method as in the following:
knex('table_name').whereNot('deleted', 1)
which translates to:
SELECT * from table_name WHERE NOT deleted = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With