Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    124

    Unanswered: 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!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by oldnickj
    ps r937 may recognize this second one!
    nope, sorry
    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
  •