mercredi 17 juin 2015

SQL Grouping by digits or first letter

Good morning everybody,

if I run the following query I get the results as expected:

SELECT upper(substr(columnname, 1, 1)) 
FROM table 
GROUP BY upper(substr(columnname, 1, 1)).

I get groups for every starting letter from A to Z and 0 to 9. But what I want to have is that I get groups like "0-9", "A-C", "D-F" and so on. I have no ideas how to group groups. Can anybody give me a hint how to start please.

Thanks!!

Aucun commentaire:

Enregistrer un commentaire