Group By and Ignore Case

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Group By and Ignore Case

    Is it possible to build a select query that groups by a value, but ignores the
    character case of the source values? For example, GROUP BY that searches a
    column for 'test" and "TEST" would combine the two values instead of grouping
    them separately.

    22 Guest

  2. Similar Questions and Discussions

    1. "group by" - order of rows in group
      this is simple example: TABLE SCHEMA: create table my_table( id int unsigned not null auto_increment primary key, project varchar(255) not...
    2. May 29 Sydney Developers Group study group
      On Monday 29th May, we'll be studying Actionscript 3. Please read the articles prior to the meeting (see <a target=_blank...
    3. cfgrid inside a <cfoutput query="myQuery" group="GROUP">
      Is it possible to use a cfgrid inside a cfoutput with a query and a group. When I try do that I get the following error: INVALID_CHARACTER_ERR:...
    4. Can String.indexOf() ignore case?
      I have a simple search which takes what is in the text input box ans searches through an array trying to find a match. I've found a nice and...
    5. #23026 [Com]: Make Zend case-sensitive (classes, functions, remove case-insensitive)
      ID: 23026 Comment by: nvivo at mandic dot com dot br Reported By: mfischer@php.net Status: Open Bug Type: ...
  3. #2

    Default Re: Group By and Ignore Case

    Different databases have different function names for converting to upper or
    lower case (ucaselcase in Access, upper/lower in Oracle and MSSQL, etc.) When
    you use GROUP BY, you need to use the same columns (without the aggregrate
    column) that you use in the SELECT, so if you wish to do a caseless group by on
    a column, you would need to convert the column in the select as well as in the
    group by.

    For example,

    SELECT UPPER(last_name) AS UClast_name, COUNT(*) AS user_count
    FROM yourtable
    GROUP BY UPPER(last_name)

    would give you a count by last name, regardless of the case. However, as you
    can see, your SELECTed value is now upper case, which may not be what you want
    to see in your output.

    Phil

    paross1 Guest

  4. #3

    Default Re: Group By and Ignore Case

    I used the Lcase() function in cfquery, but it only works in a direct query. I was trying to use it in the query of queries.
    22 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139