Results 1 to 2 of 2

Thread: GROUP BY and case sensitivity

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,694
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default GROUP BY and case sensitivity

    Code:
    SELECT article.title, article.ID, COUNT(*) AS count 
    FROM article, art_cat_relationships 
    WHERE art_cat_relationships.art_ID=article.ID 
    AND 
    (art_cat_relationships.cat_ID=22 OR art_cat_relationships.cat_ID=30) 
    GROUP BY article.title 
    HAVING count = 2 
    ORDER BY title
    My question is not as complicated as the query looks. I was noticing when double checking some values that there was an unusual false positive. I am grouping by the article titles so that only the rows pulled 2 times are displayed. In this case "Attendance program" and "attendance program" were considered to be the same since the titles were considered the same, however the titles for these two articles are actually different because in the first article the first letter of the title is capitalized where as in the second title the first letter is not capitalized.

    Any idea why these titles are considered the same and how to get the query to be case sensitive? I didn't see anything mentioned MySQL documentation about case sensitivity for this function.

    Not that it's all that important, but this is for my new article tags page where results can be further narrowed by multiple tags.
    Last edited by james438; 03-27-2012 at 03:05 PM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,694
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    It appears this has to do with how the table was collated. If it was collated as case insensitive then the query results will be treated as such.
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •