How to make a selection based on the ending value

Posted on August 30, 2008, under PHP,  Bookmark it

An SQL command that selects the field’s values that end with a specific string.

SELECT * FROM `your_table_here` WHERE field_table REGEXP 'string_here$';

The symbol $ is telling MySQL to look at the ending of the value.

Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!

Get our RSS Feed!

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)