I need the amount of words that start from all the characters of the alphabet, exist in my database
I tried the following query:
SELECT
COUNT(id) FROM(SELECT id FROM words WHERE word LIKE 'A%') as A,
COUNT(id) FROM(SELECT id FROM words WHERE word LIKE 'B%') AS B,
...
COUNT(id) FROM(SELECT id FROM words WHERE word LIKE 'Z%') AS Z
When I run the query, it gives me this error:
Incorrect syntax near 'COUNT'.
Incorrect syntax near the keyword 'AS'.
The funny thing is that the query works fine if I only ask for the words that start with 'A'
What am I doing wrong?
EDIT
Just to clarify for future readers. The reason I want one check per letter of the alphabet, is because the alphabet can be different according to the language of the user and is going to be provided each time the query is generated