right....  null did it...   thanks...


Leonardus Setyabudi wrote:
try something like : count(if(a.type = 'SBR', 1, null))
count will ignore null value .. and only count the one with 'SBR' value

br,
Leo

On 24/09/08 12:09, kalin m wrote:


no, not really...  sum is part of the query:

count(if(a.Type = "SBR", a.amount,'')), sum(a.amount) ....  group by..


i want this:

go through the records.....
   count only the ones the have type = "SBR"
   sum all amounts....
   etc...
   etc...

   group by date with rollup



i.e. i'd like to (assuming in the above example that _type_ and _amount_ are column names) sum all the amounts but count only the ones with a certain type, all other amounts that are different type should not be part of the count, but still should be summed..

how can i do that?!


thanks....




Perrin Harkins wrote:
On Tue, Sep 23, 2008 at 9:29 PM, kalin m <[EMAIL PROTECTED]> wrote:
count(if(a.Type = "Signature Based Return", a.amount,'')).... group by....
 order by....

I think you're looking for sum().

- Perrin


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to