On Jun 22, 2007, at 10:16 , Fernando Schapachnik wrote:
> Maybe this is already solved in more advanced releases, but just in
> case.
>
> VIEW active_users:
> SELECT * FROM users WHERE active AND ((field IS NULL) OR (NOT field));
You could also rewrite this as
SELECT *
FROM users
WHERE active
AND field IS NOT TRUE;
IS NOT TRUE returns true for false and null:
SELECT true IS NOT TRUE AS "true"
, false IS NOT TRUE AS "false"
, null IS NOT TRUE AS "null";
true | false | null
------+-------+------
f | t | t
This might be a little easier to read.
Michael Glaesemann
grzm seespotcode net