Hi Expert !
I need help to make a query that reflect the monthly data when i running the query on any date of the month.
- what does your data look like - do you have a date
- what have you tried
- do you mean the last 30 days or last month (month of December)
Hi,
I tried below.
I need example when I run the query 3 date of the month it give me sum of the month , I mean any date which I put the query calculate the sum of the month value?
SELECT SUM(value) ,Name FROM table
Where START_DATETIME >= CAST(CONVERT(VARCHAR, YEAR('31-OCT-2016')) + '-' + CONVERT(VARCHAR, MONTH('31-OCT-2016')) + '-' + CONVERT(VARCHAR, 1) AS DATETIME)
AND START_DATETIME < CAST(CONVERT(VARCHAR, YEAR('31-OCT-2016')) + '-' + CONVERT(VARCHAR, MONTH('31-OCT-2016')+1) + '-' + CONVERT(VARCHAR, 1) AS DATETIME)
GROUP BY Name