Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Pivot for trending?

Author  Topic 

dhw
Constraint Violating Yak Guru

332 Posts

Posted - 2008-12-11 : 11:45:37
Hello -

I am trying to write a query that will display some trending of tickets solved per week and then a final calculated/derived column that shows the trending as a percentage (positive or negative) from the last two weeks.

My table is like this:

CREATE TABLE Ticket_Trending
(
UserName varchar(20),
ReportDate datetime,
Ticket_Type1 int,
Ticket_Type2 int,
Ticket_Type3 int,
Ticket_Type4 int
)

INSERT INTO Ticket_Trending ('joe', '2008-10-03', 75, 120, 50, 12)
INSERT INTO Ticket_Trending ('cathy', '2008-10-03', 42, 8, 410, 82)
INSERT INTO Ticket_Trending ('joe', '2008-10-10', 65, 88, 57, 4)
INSERT INTO Ticket_Trending ('cathy', '2008-10-10', 40, 2, 350, 77)
INSERT INTO Ticket_Trending ('joe', '2008-10-17', 50, 80, 52, 3)
INSERT INTO Ticket_Trending ('cathy', '2008-10-17', 42, 0, 298, 3)


My other thought is that i just need to query the data and then dump into Excel and then use that to pivot the data.

Thanks for any thoughts.
- will

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-12-11 : 12:25:53
I'd go a step further and link the Excel spreadsheet to the data through a view or sproc.
Then you can use Excel to do all your charting and stats.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

dhw
Constraint Violating Yak Guru

332 Posts

Posted - 2008-12-11 : 12:33:01
Thanks for the suggestion. That is something that I have done before, with a simpler data set. I was hoping I could handle this via SQL. But good point.

thanks
- will
Go to Top of Page
   

- Advertisement -