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 5993359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:39:50+00:00 2026-05-22T23:39:50+00:00

I have the below input PlayerID MatchPlayed RunsMade ——– ———– ——– 1 10 200

  • 0

I have the below input

PlayerID    MatchPlayed RunsMade
--------    ----------- --------
1           10              200
2           5               100
3           8               24
4           30              50

The output will be

Combined Players    Combined Match Played   Combined runs Made  
----------------    ---------------------   ------------------  
1                   10                      200         
1,2                 15                      300         
1,3                 18                      224
1,4                 40                      250
1,2,3               23                      324
1,2,4               45                      350
1,3,4               48                      274
1,2,3,4             53                      374
2                   5                       100
2,3                 13                      124
2,4                 35                      150
2,3,4               43                      174
3                   8                       24
3,4                 38                      74
4                   30                      50

The Combined Match Played column is the sum of the values of Match Played column of those players. e.g. for Combined Played 1,2 the Combined Match Played value is 10 + 5 = 15.

similarly, Combined Runs Made is the sum of the Runs MAde column of the individual players. e.g. for the same example, the Combined Runs MAde column is 200 +100 =300.

Thanks

  • 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-05-22T23:39:51+00:00Added an answer on May 22, 2026 at 11:39 pm

    Setup:

    create table Input(PlayerId int, MatchPlayed int, RunsMade int)
    
    insert Input
      select 1, 10, 200
      union all select 2, 5, 100
      union all select 3, 8, 24
      union all select 4, 30, 50
    

    Query:

    with cte(Combined, PlayerId, MatchPlayed, RunsMade)
    as
    (
        select cast(PlayerId as varchar(500)), PlayerId, MatchPlayed, RunsMade
        from Input
        union all
        select cast(cte.Combined + ',' + cast(inp.PlayerId as varchar) as varchar(500)), inp.PlayerId, inp.MatchPlayed + cte.MatchPlayed, inp.RunsMade + cte.RunsMade
        from cte
            join Input inp on
                cte.PlayerId < inp.PlayerId
    )
    select Combined, MatchPlayed, RunsMade
    from cte
    order by Combined
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below situation Case 1: Input : X(P)~AK,X(MV)~AK Replace with: AP Output:
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have a drop down box and some text input fields below it. Based
I have one text input and one button (see below). How can I use
I have a paragraph of text below that I want to use an input
I have created button 2 below: <input id=Button1 type=button value=Stop onclick=alert('hello world');/> <input id=Button2
I have below test cases as input: [This is my test] [This is my
I have the below text field in my page: <input class=message id=message name=message type=text
I have below input hidden with value =/fr/images/findacourse_logo_tcm10-268.gif. <input type=hidden id=Qt_Email_Image value=/fr/images/findacourse_logo_tcm10-268.gif/> I have
I have the below input ID Activity Date 1 gardening 2011-01-01 00:00:00.000 1 gardening

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.