July 29, 2015 at 10:59 am
So basically, I'd like to get a count of a few different fields within a table, BUT ONLY for a specific date range month over month. In other words, I want the 1st of every month through the 23rd of every month.
SELECT
DATE_TRUNC('month', n.campaign_date) <--- i want the date trunc to reflect ONLY the 1st - 23rd of every month. I then want to get the count of various metrics in the same table assocaited with the 1-23rd of every month. I'm basically doing reporting month vs month to gauge effectiveness.
^^ This ideally would look like:
Date Field Metric Metric2 Metric 3
2015-01-01 - 2015-01-23 45 523 23423
2015-02-01 - 2015-02-23 45 523 23423
2015-03-01 - 2015-03-23 45 523 23423
,COUNT(numberofresponders)
,COUNT(othermetric)
,COUNT(othermetric2)
FROM
table
WHERE
campaign_date >= '2015-01-01
July 29, 2015 at 11:10 am
http://www.sqlservercentral.com/Forums/Topic1706760-2799-1.aspx
seems you have already asked the same question in link above
please dont multiple post the same question......the answers and threads get confusing for all of us
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply