How to "where like in" or "where in like" possible?

  • Is there a way to do a "like in" query?

    ej

    select * from my table

    where filed like in ('%papper%','%pen%')

    wil return

    id desc price

    2 white papper 10.23

    5 red papper 10.23

    6 blue pen 1.00

  • Not that i know of.

    But there are several alternatives:

    select * from my table

    where filed like '%papper%'

    or filed like '%pen%'

    or using a split function to get the 'papper' and 'pen' as separate rows and use a join on that table.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • "Like" and "IN" are two seperate operators.

    Simplest approach is to use

    select * from my table where filed like '%papper%'

    or filed like '%pen%'

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

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