Concatenate two rows into one row being returned

  • I have a temp table that returns the following:

    Month     Year

    09             2021

    12              2021

     

    And, I was the following returned: 09-12-2021.

     

    Is this possible?

  • Are you sure it sounds like you want "9-12 2021" as in September-December 2021.

    Select MIN(Month), '-',MAX(Month), Year

    or

    SELECT Select MIN(Month), '-',MAX(Month), '-' Year

    • This reply was modified 2 years, 1 month ago by  wburke 85918.
  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • I'd try a Lead or Lag with a partition by Year if you are on SQL 2012 or newer.

  • This was removed by the editor as SPAM

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply