I have a problem with a query in Oracle SQL.
I have a first_name
column in an employees
table. I want to group my records according to the
I think i know what you are trying to do...
You should create a small reference table with a column 'letter' (letter, sort_order)
You should your query as
select l.letter, count(e.id) as employees from letter l left outer join employee e on l.letter = substr(e.first_name, 1,1)
the other answer posted will give you unexpected results when there are no employees with a specific letter in their name...