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 > LIKE does not like!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-09, 17:41
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
LIKE does not like!

When using the following query with the colname "Edwards, III" I get no reponce. I'm guessing because of the coma. It does work when I use just "III"

SELECT id, member_id, mfirst, mlast, agreedate, cdate
FROM members
WHERE mlast LIKE %colname%

BUT...
When I use the next query with the same names I get results from "Edawrds, III" but not from "III". Here I am not using LIKE my guess that is the difference.


SELECT members.mfirst
, members.mmiddle
, members.mlast
, members.id
, members.member_id
, label.descr_lbl , EXTRACT(YEAR
FROM patients.cdate) AS Year
, EXTRACT(MONTH FROM patients.cdate) AS yyyymm
, COUNT(patients.doc_id) FROM members INNER JOIN label
ON label.value_lbl = members.demo5
INNER JOIN patients
ON patients.doc_id = members.id
AND members.mlast =colname
GROUP BY members.id , yyyymm
ORDER BY mlast, patients.cdate


Nick

ps r937 may recognize this second one!
Reply With Quote
  #2 (permalink)  
Old 10-28-09, 20:15
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by oldnickj
ps r937 may recognize this second one!
nope, sorry
__________________
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