I have two table in sql database like below:
Table 1 : event table Table 2 : game table
|event_id | game_id | |game_id | game_name |
| 140 | 10 | | 10 | football |
| 140 | 10 | | 11 | Cricket |
| 140 | 10 |
| 140 | 10 |
| 140 | 11 |
| 140 | 11 |
| 140 | 11 |
Now i want the result like below:
|game_name | Count |
| football | 4 |
| Cricket | 3 |
I have tried the query:
SELECT g.g_name, count(g.g_name) FROM game_table g INNER JOIN event_table e ON g.game_id = e.game_id WHERE event_id = '140';
but this query is given me total count not particular count of particular game name. so how can i find counts of particular game_name?
GROUP BY g.g_name