Sorry if the title is a little bit confusing. But here's what I'm facing. I am running sql query below
SELECT kodnegeri.KodNegeriText, kategorisukan.KategoriSukanText, COUNT(*) AS Total
FROM association
INNER JOIN kodnegeri ON association.KodNegeri = kodnegeri.KodNegeri
INNER JOIN kategorisukan ON association.KodKategoriSukan = kategorisukan.KategoriSukan
GROUP BY kodnegeri.KodNegeriText, kategorisukan.KategoriSukanText
And the query returns the following table
KodNegeriText | KategoriSukanText | Total
Johor | Sukan Kecergasan | 16
Johor | Sukan Paralimpik | 1
Johor | Sukan Prestasi.. | 227
Johor | ... | ...
Kedah | Sukan Kecergasan | 14
Kedah | Sukan Paralimpik | 8
Kedah | ... | ...
As you can see under KodNegeriText, there are repeating rows (eg: Johor). How can I eliminate the repeating KodNegeriText items to obtain such result that only displays the KodNegeriText once.
Example.
KodNegeriText | KategoriSukanText | Total
Johor | Sukan Kecergasan | 16
| Sukan Paralimpik | 1
| Sukan Prestasi.. | 227
| ... | ...
Kedah | Sukan Kecergasan | 14
| ... | ...
I have tried playing around with DISTINCT but failed to find the solution.