Reputation: 21
I need to count names of employees in alphabetical order from employees table in HR schema (oracle)
Example..
Last_name with. Count
A. 4
B. 3
...
...
Z. 5
How the query will look like..
Upvotes: 0
Views: 147
Reputation: 2393
I think this will do:
select SUBSTR(name,1,1) as name,count(1) as CNT from YOURTABLE
group by SUBSTR(name,1,1)
order by name
Upvotes: 1