Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Unanswered: Problem with LIKE Operator.

    When I fetch the records from the LIKE operator then the query returns no results but when I fetch records from the equal to (=) operator then the query return results.

    Following user name are stored in the database:

    (1) `~@#$%'\|/?.><^&%@()-_+-:
    (2) (){}[]|\/?"*&^%$#@test`


    I am searching the records from the LIKE operator as the following ways:

    (1) SELECT * FROM user WHERE user LIKE '%`~@#$%''\\|/?.><^&%@()-_+-:%'
    (2) SELECT * FROM user WHERE user LIKE '%(){}[]|\\/?"*&^%$#@test`%'

    And I am fetching the records from the equal to (=) operator as the following ways:

    (1) SELECT * FROM user WHERE user = '`~@#$%''\\|/?.><^&%@()-_+-:'
    (2) SELECT * FROM user WHERE user = '(){}[]|\\/?"*&^%$#@test`'

    But when I am fetching the records from the LIKE operator then the query returns no results and when I am fetching records from the equal to operator then the query returns results. Both of the SQL query is shown above.

    Please suggest how I will solve this problem.

    Thank You
    Sujeet.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by sujeetsin
    Please suggest how I will solve this problem.
    use the equals operator

    rudy.ca | @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
  •