Re: SUM() Math in mySQL

From: Date: Mon, 20 Dec 2010 04:44:41 +0000
Subject: Re: SUM() Math in mySQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47563@lists.php.net to get a copy of this message
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/

« previous php.db (#47563) next »