# Coding a case insensitive GROUP BY in uSQL

**URL:** <https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic, usql\
**Created:** [May 1, 2023, 6:20pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538 "2023-05-01T18:20:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![eugenm](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eugenm](https://community.dynatrace.com/u/eugenm)\
**Post date:** [May 1, 2023, 6:20pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/1 "2023-05-01T18:20:24Z")

</div>

Hi,

I know that case insensitivity is not supported in uSQL, at least not outright.

Is there any workaround available whereby I can group by a column (e.g. a “First and Last Name” text column), while supporting any format for the respective field, in any case type?

End result is that John Doe, john doe, and JOHN DOE are all grouped together, under any of the 3 versions.

If uSQL supported any way to normalize this it would be easy - by changing them all to lower or upper cases, for e.g.

These text entries are not mapped to any userID or other identifier, BTW.

---

<div class="post-metadata">

**Author:** ![eugenm](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eugenm](https://community.dynatrace.com/u/eugenm)\
**Post date:** [May 9, 2023, 4:08pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/2 "2023-05-09T16:08:43Z")

</div>

Bumping this request up…&nbsp;  
Is there really no solution, uSQL/ Dynatrace experts?

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [May 9, 2023, 10:00pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/3 "2023-05-09T22:00:03Z")

</div>

Hi [@eugenm](https://community.dynatrace.com/user/58638) string values are case-sensitive. For example, SELECT city FROM usersession WHERE userId LIKE “\*dynatrace\*” matches [me@dynatrace.com](mailto:me@dynatrace.com) but not [me@dynaTrace.com](mailto:me@dynaTrace.com). To avoid this, use the ? wildcard character as in this example: SELECT city FROM usersession WHERE userId LIKE “\*dyna?race\*”

Never tried it personally but maybe you can use some of the above.Maybe some example can be enlightening

---

<div class="post-metadata">

**Author:** ![eugenm](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eugenm](https://community.dynatrace.com/u/eugenm)\
**Post date:** [May 10, 2023, 2:34pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/4 "2023-05-10T14:34:10Z")

</div>

Thanks, but wild cards don’t work.

I have to be able to catch ALL case type variations, as explained in my request - including ALL CAPS.

The wildcard solution may work for capturing lower case and title case, but it’s missing all caps.

SELECT COUNT(DISTINCT usersession.stringProperties.techid) AS “TechID”, usersession.stringProperties.manager as “Manager” FROM useraction GROUP By usersession.stringProperties.manager

This should consolidate the number of techid’s under each manager, regardless of how manager is spelled, caps wise. The techid counts for manager names listed as “John Doe”, “john doe” and “JOHN DOE” muse be grouped together in the output. The normalization can be done under one of the variants, say “JOHN DOE”.  
The problem is that there is no way to normalize text in uSQL, nothing like UPPER() or LOWER() or any similar function that I know of.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [May 10, 2023, 5:22pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/5 "2023-05-10T17:22:12Z")

</div>

Understood, I see no option. What I try to do in this case is to change the source, using a normalized List or Choice no allowing the user to type it.

---

<div class="post-metadata">

**Author:** ![eugenm](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eugenm](https://community.dynatrace.com/u/eugenm)\
**Post date:** [May 10, 2023, 6:18pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/6 "2023-05-10T18:18:07Z")

</div>

That’s really disappointing. This is a significant product gap, in my opinion.

It is very difficult to address this in the source data, for various reasons.

And this is just one example. There are quite a few data fields that pose this challenge, when it comes to our project needs.

Hopefully, input text field normalization support can be added - via ANY means. And it must support the GROUP BY use case.

Thank you

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [May 10, 2023, 7:37pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/7 "2023-05-10T19:37:37Z")

</div>

Your welcome, you still can create a [Dynatrace Product Idea](https://community.dynatrace.com/category/DynatraceProductIdeas) to request this feature.

---

<div class="post-metadata">

**Author:** ![agata.wlodarczyk](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/agata.wlodarczyk/32/22_2.png) [@agata.wlodarczyk](https://community.dynatrace.com/u/agata.wlodarczyk)\
**Post date:** [May 22, 2023, 1:11pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/8 "2023-05-22T13:11:49Z")

</div>

[@eugenm](https://community.dynatrace.com/user/58638)&nbsp;Did you submit a product idea based on your needs?  
If yes, please share the link to it, so all Community members can be up to date with that case.

---

<div class="post-metadata">

**Author:** ![eugenm](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@eugenm](https://community.dynatrace.com/u/eugenm)\
**Post date:** [May 23, 2023, 8:53pm UTC](https://community.dynatrace.com/t/coding-a-case-insensitive-group-by-in-usql/39538/9 "2023-05-23T20:53:12Z")

</div>

Thanks for reminding me to do it.

I’ve added it&nbsp;[HERE](https://community.dynatrace.com/post/212957#M37634)

I’d be OK with either a Group By with case option, or having support for LOWER() and UPPER().
