Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011

    Unanswered: Need help with using REGEXP in my SELECT statement

    I have a field that contains a list of numbers seperated by commas.

    For example, my field would contain something like this:

    I only want to search for the very last item in the list. In this case it would be 16. My current SELECT looks like this:

    SELECT * FROM `table` where `column` REGEXP ',[[:<:]]16[[:>:]]$'

    It returns no records. Whats wrong with my SELECT?
    Last edited by ral1239; 09-16-11 at 11:11.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    use the SUBSTRING_INDEX function for this, with -1 to designate the last item in the list | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts