I\'m not sure what should I write in the following SQL query to show \'date\' column like this: \"month-year\" - \"9-2011\".
SELECT MONTH(date) + \'.\' + YE
If you want to stay having the field in datetime datatype, try using this:
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, o.[date]), 0) AS Mjesec, SUM(marketingExpense) AS SumaMarketing, SUM(revenue) AS SumaZarada
FROM [Order] o
WHERE (idCustomer = 1) AND (o.[date] BETWEEN '2001-11-3' AND '2011-11-3')
GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, o.[date]), 0)
It it also easy to change to group by hours, days, weeks, years...
I hope it is of use to someone,
Regards!