Need help to search strings like o'brain and obrain.

  • I have a criteria that if user have give o'brain then

    i have to fetch both records ie.. (obrain & o'brain)

    what i am looking for is

    SELECT surname,*FROM table WHERE surname LIKE 'O''brain%'

    union ALL

    SELECT surname,*FROM table WHERE surname LIKE 'obrain%'

    but in a single query?

    thanks in advance...

  • hi,

    have you tried something like

    SELECT surname, * FROM table WHERE surname LIKE '%brain'

    regards

  • this will not serve my purpose...

    thanks for your time...

  • Hi charles

    What exactly are you trying to do with the SQL, if you want a query that starts with 0 and then ends with Brain with some middle characters then try something like Name like 'O%Brain'

    Hope this helps 🙂

  • hi,

    This will solve my problem ,Thanks...:-)

    Regards,

    Charles

Viewing 5 posts - 1 through 4 (of 4 total)

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