MySQL Forums
Forum List  »  Newbie

Re: How to check if `Pcode` from the table is in the string 'AB134DE'
Posted by: Rick James
Date: September 16, 2014 03:55PM

mysql> SELECT city, state FROM us WHERE LEFT('ALABAMA', LENGTH(state)) = state limit 4;
+----------------+-------+
| city           | state |
+----------------+-------+
| Alabaster      | AL    |
| Albertville    | AL    |
| Alexander City | AL    |
| Anniston       | AL    |
+----------------+-------+

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.