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' as test
FROM
contents
WHERE name LIKE 'C%'
GROUP BY
test
ORDER BY id ASC
different solutions and info about performances are welcome ( maybe using DISTINCT? )
thanks in advance!
This should perform as well as any other option –
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 –