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 > select ...like

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-05, 06:22
archVille archVille is offline
Registered User
 
Join Date: Nov 2005
Posts: 40
select ...like

how can i build a query select ... like
with :

select x,y, from y,z,
where w like '%y%' ?????????

I want the y to be the value and not a single string or character!!!
For example if all the y's are values like names : "Peter,John,Bob,..." to find the w ' s that contain the name :"Peter,John,Bob,..." and not the y character or the &y or the $y e.t.c.Is there a way to do that ???

Anyone idea???
Reply With Quote
  #2 (permalink)  
Old 11-18-05, 07:04
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,260
if you are using the like clause then I suppose
where forename like name1 or foremame like name2

also where forename in (name1,name2,name3)
Reply With Quote
  #3 (permalink)  
Old 11-18-05, 07:32
archVille archVille is offline
Registered User
 
Join Date: Nov 2005
Posts: 40
Quote:
Originally Posted by healdem
if you are using the like clause then I suppose
where forename like name1 or foremame like name2

also where forename in (name1,name2,name3)
Yes sure,but what if i have 500 names??(in my case unfortunatelly i have)...
Reply With Quote
  #4 (permalink)  
Old 11-18-05, 07:56
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by archVille
where w like '%y%' ?????????
WHERE w LIKE CONCAT('%', y, '%')

--
felix
Reply With Quote
  #5 (permalink)  
Old 11-18-05, 09:39
archVille archVille is offline
Registered User
 
Join Date: Nov 2005
Posts: 40
Quote:
Originally Posted by felixg
WHERE w LIKE CONCAT('%', y, '%')

--
felix
Thanx a lot ! I have tried this without concat somehow and it didnt work!
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