Most of the time we like to get the total number of occurrence of a column value in a table for example:
TABLE NAME : REPORTS
ReportName | ReportPrice |
---|---|
Test | 10.00 $ |
Test | 10.00 $ |
Test | 10.00 $ |
Test 2 | 11.00 $ |
Test | 10.00 $ |
Test 3 | 14.00 $ |
Test 3 | 14.00 $ |
Test 4 | 100.00 $ |
SELECT
ReportName AS REPORT NAME,
COUNT(ReportName) AS COUNT
FROM
REPORTS
GROUP BY
ReportName
REPORT NAME | COUNT |
---|---|
Test | 4 |
Test 2 | 1 |
Test 3 | 2 |
Test 4 | 1 |