Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8506845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:42:14+00:00 2026-06-11T02:42:14+00:00

I have data such as this: Inventors column in my table Hundley; Edward; Ana

  • 0

I have data such as this:

Inventors column in my table

Hundley; Edward; Ana
Isler; Hunsberger
Hunsberger;Hundley

Names are separated by ;. I want to write a SQL query which sums up the count.

Eg. The result should be:

Hundley     2
Isler       1
Hunsberger  2
Edward      1
Ana         1

I could do a group by but this is not a simple group by as you can see. Any ideas/thoughts on how to get this output?

Edit: Changed results so it doesn’t create any confusion that a row only contains 2 names.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:42:16+00:00Added an answer on June 11, 2026 at 2:42 am

    You can take a look at this. I certainly do not recommend this way if you have lots of data, BUT you can do some modifications and use it and it works like a charm!

    This is the new code for supporting unlimited splits:

    Declare @Table  Table   (
        Name    Nvarchar(50)
    );
    
    Insert  @Table  (
        Name
    )   Select  'Hundley; Edward; Anna'
    Union   Select  'Isler; Hunsberger'
    Union   Select  'Hunsberger; Hundley'
    Union   Select  'Anna'
    ;
    
    With    Result  (
        Part
    ,   Remained
    ,   [Index]
    ,   Level
    )   As  (
        Select  Case    When    CharIndex(';', Name, 1) =   0
                Then    Name
                Else    Left(Name, CharIndex(';', Name, 1) - 1)
            End
        ,   Right(Name, Len(Name) - CharIndex(';', Name, 1))
        ,   CharIndex(';', Name, 1)
        ,   1
            From    @Table
    Union   All
        Select  LTrim(
            Case    When    CharIndex(';', Remained, 1) =   0
                Then    Remained
                Else    Left(Remained, CharIndex(';', Remained, 1) - 1)
            End
        )
        ,   Right(Remained, Len(Remained) - CharIndex(';', Remained, 1))
        ,   CharIndex(';', Remained, 1)
        ,   Level
        +   1
            From    Result
            Where   [Index] <>  0
    )   Select  Part
        ,   Count(*)
            From    Result
            Group   By  Part
    

    Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database field with data such as this: 76,60,12 If I want
I have a table with data such as this: <table> <tr onclick=window.location='download.php?id=1'> <td>Program 1<br/>Short
I have a data frame with two columns. First column contains categories such as
If I have a simple table where the data is such that the rows
I have a table with data such as below Group Start Date End Date
I have a char(12) column with data such as: 000000004012 000000615737 000000000012 000000000100 And
I have data such as this: yr X lower upper 1 2004 0.2852 0.3927
I have my UITableView data organized such that the sections of the table are
I have two tables: Departments --< Employees Department table has data such as: id,
I have a data.table such as the following: a <- data.table(color=c(Red,Blue,Red,Green,Red,Blue,Blue), count=c(1,2,6,4,2,1,1),include=c(1,1,1,1,0,0,1)) > a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.