Avatar of Grayson Hampton
Grayson Hampton

asked on 

Help with query that Counts and TRIMS values in a column

I need to create a query that Counts the occurrences of BusinessSectorList to Name.
But, the values in BusinessSectorList have spaces and semi-colons.

The values in BusinessSectorList have the following 3 issues.

1. If there is a space (' Healthcare ') before or after the first value, remove it
2, If there is a space and semi-colon and another space ( ; Healthcare) before the first value, remove it.
3. If a semi-colon exist after the first value, remove it

Current Output Results:

BusinessSectorList                                                        Name
 Healthcare                                                                      Charlotte Spine Center
 ; Healthcare                                                                      Accolade, Inc.
Healthcare                                                                      Accolade, Inc.
Food;Wholesale                                                              The Schwan Food Company
Healthcare;Non-Profit                                                      12 and 12 Inc.

Desired Output Results:

BusinessSectorList                         Name                                                  Count
Healthcare                                       Charlotte Spine Center                     1
Healthcare                                       Accolade, Inc.                                     2
Healthcare                                        12 and 12 Inc.                                    1
Wholesale                                        The Schwan Food Company            1

Avatar of undefined
Last Comment
Ryan Chong

8/22/2022 - Mon