I'm running mysql and php4. I was wondering if there was a fast way to query the database and return results based only on their first letter. Like if i wanted to return every item that started with A or every item that started with B. I know I could do a complete query and then sort into an array by doing a substring search on the first letter of each item but that seems rather time consuming for the server especially if the database returns 1000 items on the query. Is there a faster way to do this? Thanks
use the ORDER BY clause.
"SELECT [column] from [table] where [column] LIKE 'A%'", etc.
it's possible that instead of using like you could use ASCII(str) = 65
that's a case sensitive approach, however.
Thanks that was exactly what i was looking for.