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
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 wa
On Tue, Sep 23, 2008 at 10:09 PM, kalin m <[EMAIL PROTECTED]> wrote:
> 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
It doesn't work because you are counting values. An empty string is
still a value. Perhaps you are trying to SUM instead? If you are
really looking for a count, you also should use sum.
sum(if(a.Type = "Signature Based Return", 1,0))
That will return a count of those records where a.Type = "
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
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 unsubscri
hi all...
can somebody explain why a conditional count like this one doesn't work:
count(if(a.Type = "Signature Based Return", a.amount,'')) group
by order by
or
if(a.Type = "Signature Based Return", count(a.amount),'') group
by order by...
thanks...
--
MySQL
>Description:
3 "select" with little difference (2 with strange result, and last correct)
==
select
Schedule.PTRScheme as Scheme_ID,
Subject.TID as Subject_TID,
Scheme.PTRSubject as Subject_ID,
if(c