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

  • Home
  • SEARCH
  • 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 6369631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:49:48+00:00 2026-05-25T00:49:48+00:00

H All, I have following ResultSet generated by some 3-4 queries in T-Sql. The

  • 0

H All,

I have following ResultSet generated by some 3-4 queries in T-Sql. The result looks something like this:

Month Payment
January 200
February 200
March 200
April 200
june 200
July 200
August 200
September 200
October 200
November 200
December 200

Now, depending on userdefined value, lets say 4, I need to arrange them some like this.

Month Payment
January;Febrary;March;April 200
May;June;july;August 200
…………. so on.

If the user has chosen for 3, then,

Month Payment
January;Febrary;March 200
April;May;June 200
…………. so on.

How do I do this? Any suggestions?
Thanks in Advance!!
:))

  • 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-25T00:49:48+00:00Added an answer on May 25, 2026 at 12:49 am

    I honestly don’t know how to handle payment since you have not described it, here is a way of solving it with recusive sql

    declare @t table([Month] varchar(12), Payment int)
    declare @uservalue int
    set  @uservalue = 3
    insert @t values('January',200)
    insert @t values('February', 200)
    insert @t values(' March', 200)
    insert @t values('April', 200)
    insert @t values('May', 200)
    insert @t values('June', 200)
    insert @t values('July', 200)
    insert @t values('August', 200)
    insert @t values('September', 200)
    insert @t values('October', 200)
    insert @t values('November', 200)
    insert @t values('December', 200)
    
    ;with a as(
    select month, payment, rn = row_number() over (order by (select 1))
    from @t
    ), b as
    (
    select cast(month as varchar(200)) month, payment, rn
    from a where (rn - 1) % @uservalue = 0
    union all
    select cast(b.month +';'+ a.month as varchar(200)), a.payment, a.rn
    from b join a on a.rn - 1 = b.rn and b.rn %@uservalue > 0
    )
    select month, payment from b where rn % @uservalue = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following case: All boats have a boat type like shark ,
I have following statement for query articles from some sections Article.all(:joins => :sections, :conditions
I have the following Regex to match all link tags on a page generated
Netbean 6.9 generated the following JPA entity class from this SQL Server 2008 table:
Dear all, I have a select query that currently produces the following results: DoctorName
The rails books and web pages I've been following have all stuck to very
I have following setup, but when I put 1024 and replace all 512 with
I have the following code to zip all the files and then save it
I have the following program to browse all virtual directories and their sub directories
I have the following query (all tables are innoDB) INSERT INTO busy_machines(machine) SELECT machine

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.