-1

I want to count a certain value in a column and output it as a number. Here is an example:

id job
1 police
2 police
3 ambulance

Now I want to count the value "police" in the "job" column and make the result in a number, so because there are two entries with "police" in the column it would be as output the number two. With the value "ambulance" it is only one entry so the result would be 1.

Can anyone tell me how to write this as code? I have now searched a lot on the Internet and tried myself but I have found nothing that worked.

Cabonie
  • 3
  • 2

1 Answers1

0

You're saying you want to count how many of each type of job there is, right?

SELECT COUNT(*), job
FROM tablename
GROUP BY job
Andy Lester
  • 91,102
  • 13
  • 100
  • 152