Re: NULL to 0 result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 14, 2010 at 4:53 PM, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:
>
> What change is needed to this query so if “currently_in_rss” is NULL it will be assigned a value of 0
>
> SELECT `reference`, COUNT(`reference`) AS currently_in_rss FROM `ministry_profiles` WHERE `rss_feed_include` = 1 GROUP BY `rss_feed_include`
>
> Ron
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>

SELECT `reference`, ifnull(COUNT(`reference`),0) AS currently_in_rss
FROM `ministry_profiles` WHERE `rss_feed_include` = 1 GROUP BY
`rss_feed_include`

-- 

Bastien

Cat, the other other white meat

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux