Dear all,
Supposed that we have a table Person that contains two column (Name, Car).
Supposed that we have 3 kind of car: Car1, Car2, Car3.
How can we count the number of each kind of car that a person have without using 3 different separated SQL queries like that:
Select Name, count(*) from Person where Car = 'Car1' Group By Name .
Select Name, count(*) from Person where Car = 'Car2' Group By Name .
Select Name, count(*) from Person where Car = 'Car3' Group By Name .
I would like to use only 1 SQL query to do this.
Thanks you.
Supposed that we have a table Person that contains two column (Name, Car).
Supposed that we have 3 kind of car: Car1, Car2, Car3.
How can we count the number of each kind of car that a person have without using 3 different separated SQL queries like that:
Select Name, count(*) from Person where Car = 'Car1' Group By Name .
Select Name, count(*) from Person where Car = 'Car2' Group By Name .
Select Name, count(*) from Person where Car = 'Car3' Group By Name .
I would like to use only 1 SQL query to do this.
Thanks you.