Query based on partial element
I would like to select rows based on the first character of an element. An easy example is a last name element. I would like to select all the rows where the name starts with "A".
I know I could create another element with the one letter, but if there is a way to do this without changing the DB and updates that would be nice.
WHERE lastName LIKE 'A%'
% is a wildcard. If you wanted to get records where the last name has an A _anywhere_ in it, you would use LIKE '%A%'; if you wanted records where the last name ENDED with an A, you would use LIKE '%A'; the above example looks for last names that BEGIN with A.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)