question

newbee avatar image
0 Votes"
newbee asked Viorel-1 answered

Select multiple columns from table but Group By one column

Hi Have a table where I m having data like below

99217-image.png



Now I want to group my data based on only country like below

99204-image.png

I has to sum the data based on country only and show remaining columns.


sql-server-general
image.png (17.6 KiB)
image.png (7.9 KiB)
image.png (6.5 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Do you want to group by country or to obtain the second picture?

0 Votes 0 ·

Actually I want to group by date or day.
For each date it has to sum the calls data.

0 Votes 0 ·

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

Try something like this:

 select [Date], [Day], sum([Calls]) as Calls
 from MyTable
 group by [Date], [Day]
 order by [Date]


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.