Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

SQL gourping by multiple columns help

$
0
0
Hello,I have the following table:ID bigint,Name varchar(50),Address varchar(250),RecDate smalldatetime,PurPrice decimal(7,2),PaidBy varchar(50)I am trying to come up with a select statement that will group the results by ID and sums the PurPrice but also at the same time group the returned result by month extracted from RecDate.Is this possible in one statement?example of output would be something like this:ID Name SumPrice Month1 Test 1500 011 Test 1000 02etc...Thanks in advance

Viewing all articles
Browse latest Browse all 3145

Trending Articles