MySQL Forums
Forum List  »  Newbie

Re: Different Count(distinct) in the same query
Posted by: Rick James
Date: May 11, 2014 11:23AM

First a comment on the schema... Today, you have types a,b,c; tomorrow you will have a,b,c,d. What will you do? The answer is that you should have those columns (%_txn and %_currency) in another table with multiple rows as needed.

I'm confused as to what you are doing, but here are some tips:
SUM(b_txn <> 0) -- counts the number of rows with b_txn <> 0
GROUP BY customer -- may be necessary

Please provide SHOW CREATE TABLE

You want txn=45 -- please show us which numbers add up to 45.

Options: ReplyQuote


Subject
Written By
Posted
Re: Different Count(distinct) in the same query
May 11, 2014 11:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.