If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Problem with LIKE Operator.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-10-09, 09:40
sujeetsin sujeetsin is offline
Registered User
 
Join Date: Jul 2009
Posts: 1
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.
Reply With Quote
  #2 (permalink)  
Old 07-10-09, 09:50
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by sujeetsin
Please suggest how I will solve this problem.
use the equals operator

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On