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 > count, but still should be summed..
You can either use sum, having your if() return 0 or 1, or use count(), having your if return 1 or NULL. If you change the '' to NULL in your previous example, it would work. - Perrin -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]