SQL Group by column AND by date I am trying to write a query to pull group data by payment_method (one of columns in table) and by date. I can pull the query without grouping by date, but once I add the dates, I am unable to get the query to work. Does anyone have any idea how to fix my query?

Current query:

SELECT payment_method,SUM(net_amount)
DATEADD(MONTH, DATEDIFF(MONTH, 0, transaction_time),0) as OrderDateByMonth
FROM Database
WHERE [criteria]
GROUP BY payment_method
AND DATEADD(MONTH, DATEDIFF(MONTH, 0, transaction_time),0)
ORDER BY payment_method
AND OrderDateByMonth
You just need to use commas instead of AND:

SELECT payment_method, 
       SUM(net_amount),
       DATEADD(MONTH, DATEDIFF(MONTH, 0, transaction_time),0) AS OrderDateByMonth
FROM [Database]
WHERE [criteria]
GROUP BY payment_method,     -- &lt;--- comma here
         DATEADD(MONTH, DATEDIFF(MONTH, 0, transaction_time),0)
ORDER BY payment_method,     -- &lt;--- and here
         OrderDateByMonth ;