How to find a value stored in a field with "array format"

  • I have a field named "numbers" with values like
    (1) 1,6,9,10,200
    (2) 5,9,20
    (3) 6,10,20
    (4) 1,3,6

    I need to find all record that match number 6.. for example records (1), (3) and (4)
    Thanks!

  • bottasergio - Friday, January 4, 2019 5:34 AM

    I have a field named "numbers" with values like
    (1) 1,6,9,10,200
    (2) 5,9,20
    (3) 6,10,20
    (4) 1,3,6

    I need to find all record that match number 6.. for example records (1), (3) and (4)
    Thanks!

    SELECT *
      FROM myTable x
     WHERE ',' + x.numbers + ',' LIKE '%,6,%'

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply