MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 30th, 2000, 12:24 PM
wizard wizard is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Osoyoos, BC, Canada
Posts: 3 wizard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello,

I have an odd problem, when ever I do a select on my table like this:

SELECT * FROM table_name WHERE LCASE(skills) LIKE "%string1%" OR "%string2%";

MySQL will return a row only matching "string1" and then stop. Is there a way to make it continue after it finds a match?

I've looked in the mysql documentation.
I'm using MySQL version 3.22.34 on win98 and FreeBSD. Any help would much aperciated.

Reply With Quote
  #2  
Old August 30th, 2000, 12:52 PM
RyanP
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I don't think that you can imply that the value after the OR should be applied to the previous condition LIKE

try

SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LIKE '%string2%';

Reply With Quote
  #3  
Old August 30th, 2000, 01:02 PM
wizard wizard is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Osoyoos, BC, Canada
Posts: 3 wizard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by RyanP:
I don't think that you can imply that the value after the OR should be applied to the previous condition LIKE

try

SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LIKE '%string2%';
[/quote]


Thanks for the quick reply.. but that gave a syntax error at the second LIKE..

Reply With Quote
  #4  
Old August 30th, 2000, 05:17 PM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
You SQL should be:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LCASE(skills) LIKE '%string2%';
[/code]
Note the use of single quotes -- standard SQL defines the single quote character to delimit a string, not the double quote. MySQL may accept both, but other DBs are likely to be less forgiving.

Reply With Quote
  #5  
Old August 30th, 2000, 07:27 PM
RyanP
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
oops!

thanks for the save chris

Reply With Quote
  #6  
Old August 31st, 2000, 10:31 AM
wizard wizard is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Osoyoos, BC, Canada
Posts: 3 wizard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, thanks for the help Chris. That worked perfectlly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > MySQL Selects


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT