a noob question here!
I wrote this query, but the \"group by\" is very stupid... so, how can I correct this?
SELECT
COUNT(*) AS total,
\'x\'
This should perform as well as any other option -
SELECT
LEFT(name, 1) AS first_letter,
COUNT(*) AS total
FROM contents
GROUP BY first_letter
If you want to run this query for a single letter at a time you can add the WHERE clause and drop the GROUP BY -
SELECT COUNT(*) AS total
FROM contents
WHERE name LIKE 'a%'