I have a customer table:
id name
1 customer1
2 customer2
3 customer3
and a transaction table:
id customer amount type
1 1 10 type1
2 1 15 type1
3 1 15 type2
4 2 60 type2
5 3 23 type1
What I want my query to return is the following table
name type1 type2
customer1 2 1
customer2 0 1
customer3 1 0
Which shows that customer1 has made two transactions of type1 and 1 transaction of type2 and so forth.
Is there a query which I can use to obtain this result or do I have to use procedural code.