When I run a query in MS Access I can happily use a query like this:
SELECT clients.* FROM clients WHERE active=True;
or
SELECT clients.* FROM clients WHERE active=-1;
but not
SELECT clients.* FROM clients WHERE active=1;
In addition, say I want to query the database using PDO I might use a prepared statement:
$db->prepare('SELECT clients.* FROM clients WHERE active=:isactive;');
$db->bindValue(':isactive', True); //Does not work
$db->bindValue(':isactive', 1); //Does not work
$db->bindValue(':isactive', -1); //Does work
So even though true
works when sending a plain query to Access, if binding only -1
or 0
will work for boolean.
Why is this and why is -1
representative of true
when 1
usually means true
in other languages/databases?