Alex Rivera | Logout

How do you select from mysql where last character in a string = x?

Asked 2009-08-13T04:42:08.137
11

I'd like to select rows from the database where the last character in the mov_id column equals to 1 and 2.

How would the query look like?

Edit
Report

1 Answer

26
SELECT * FROM `myTable` WHERE `mov_id` LIKE '%1' OR `mov_id` LIKE '%2'

the % character is a wildcard which matches anything (like * in many other places)

answered 2009-08-13T04:44:44.263

Your Answer