Home > front end >  Is there a way to concatenate multiple rows into one rows keeping same dataset format in SQL?
Is there a way to concatenate multiple rows into one rows keeping same dataset format in SQL?

Time:12-14

How in sqlserver do I go from this:

enter image description here

to this :

enter image description here

Many thanks...

Regards,

CodePudding user response:

SELECT
    SUM ( [January] ) AS [January],
    SUM ( [February] ) AS [February]
FROM MyTable;

This SUMs the value for each column specified. Without more details, there is no telling if additional grouping is needed, but it does sum your column values for a resultset--assuming that is your intent, and not looking for MAX, etc.

  • Related