MySQL Forums
Forum List  »  Newbie

Count / Group
Posted by: Felix Widmer
Date: April 16, 2018 12:40AM

Hi,

I try do create a report from a table but I have no idea how to get the result ...

I have a table like this with the 3 columns customer, order and state:

Customer oder state
------------------------------------------
Ann 100 delivered
Ann 101 delivered
Ann 102 canceled
Ann 103 new
Bob 200 delivered
Bob 201 canceled
Bob 202 canceled
Bob 203 delivered

What I try to o is a select that gives me the number of orders in specific states for each customer:

Customer New Orders Delivered orders Canceled Orders
---------------------------------------------------------------
Ann 1 2 1
Bob 0 1 1

Any idea to do this in a simple way ?

Options: ReplyQuote


Subject
Written By
Posted
Count / Group
April 16, 2018 12:40AM
April 16, 2018 01:39AM


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.