Re: SUM() Math in mySQL

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

 



On 20/12/10 15:38, Ron Piggott wrote:
I am working on the query below.  It’s purpose is to manage the RSS Feed for the site.

The part of the query I am struggling with is:

SUM(`include_in_rss_feed`) AS current_rss_feed

What I need is the total value of *ALL* the `include_in_rss_feed` , not the specific row.

`include_in_rss_feed` is an integer.  It only ever has a value of 1

Well you're going to get an error with your current attempt - but you know that already I assume. You have an aggregate function (sum) but no group by clause for the outer query.

I think you're better off just having 2 queries - one with the sum() and the group by include_in_rss_feed, and one with all of your other data. I don't think combining them will be very easy.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
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