I'm creating a glossary page that has the letters of the alphabet listed across the top, each being a bookmark that takes you to the relevant letter section on the page. If there are no entries for a letter in the DB, I don't want the letter to be a link.
At the moment, i do 26 SELECT LIKE statements (e.g. 'a%', 'b%', etc.) - and it works, but it's grossly ineffcient.
Can I do this in a single MySQL statement and then do the processing in PHP? I'm assuming there is some kind of GROUP BY syntax I can use?