Jump to content

Sorting Data By It's First Letter


Grabeorama
 Share

Recommended Posts

Is there a way of retrieving data from a table, but only sorting by it's first letter?For example if I wanted to pull all entries for the column 'Names' that started with the letter A, then on a separate occasion sort them by the letter B etc.

Edited by Grabeorama
Link to comment
Share on other sites

SELECT * FROM blog WHERE SUBSTR(Name, 1) = 'A'It would probably be better to use the LEFT function though, that returns a certain number of characters from the left side. That sounds like exactly what you need, so the database will probably run that faster.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...