Re: Need efficient way to do comparison with NULL as an option - Mailing list pgsql-general

From Lew
Subject Re: Need efficient way to do comparison with NULL as an option
Date
Msg-id wK6dnSHN9r8AOuLanZ2dnUVZ_gqdnZ2d@comcast.com
Whole thread Raw
In response to Re: Need efficient way to do comparison with NULL as an option  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-general
D. Dante Lorenso wrote:
>> But if I want to find all the items which are not in any folder, I want:
>>
>>   SELECT *
>>   FROM mytable
>>   WHERE folder_id IS NULL;
>>
>> I don't have any folder_id 0, so on a URL I might do this:
>>
>>   http://xyz/page.php?fid=123
>>   http://xyz/page.php?fid=0

SELECT * FROM mytable WHERE COALESCE( folder_id, 0 ) = 0;

--
Lew

pgsql-general by date:

Previous
From: cdecarlo
Date:
Subject: Setting variables equal to elements from an Array
Next
From: "O'Shea, Brendan"
Date:
Subject: Re: ERROR: catalog is missing 9 attribute(s) for relid 10297