CaptainGiblets
asked on
SQL Pivot Table
I have data that has 2 columns, a status and a date.
is it possible to build the following report in SQL and if so how would I do it
Today Yesterday Week Month
StatusA
StatusB
So I would want a total sent today from statusA and B then yesterdays everything this week and finally everything this month (last 7 and 30 days)
is it possible to build the following report in SQL and if so how would I do it
Today Yesterday Week Month
StatusA
StatusB
So I would want a total sent today from statusA and B then yesterdays everything this week and finally everything this month (last 7 and 30 days)
So, count of all StatusAs for today, count of all from yesterday, etc?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That works a treat, just a quick question before I close it off, if I wanted to use a different date field for 2 different statuses is this possible? From what I know I would have to create 2 different views with the different date field but just thought I would throw it out there.
For example 2 status "Sent Out" and "Returned" with 2 dates "date Sent Out" and "Date Returned"
For example 2 status "Sent Out" and "Returned" with 2 dates "date Sent Out" and "Date Returned"
Sounds to me that that approach could be extended to additional date columns...