December 28, 2007 at 7:00 am
Todd,
There is no doubt that using PIVOT is beneficial in some situations; however, multiple aggregations is not one of them. In your example, you cannot "easily" provide a sum of dollars, count of units and a total of all products sold for a particular TestOrder. In most cases, users want to quantify how much money, how many units, and when items are sold. It would be much more beneficial if PIVOT were able to accommodate more than one aggregation.
Maybe I am reading too much into what I believe the functionality should be, but I have found very few situations where using PIVOT has been more beneficial than standard TSQL.
December 28, 2007 at 7:31 am
I will confess that I was not considering multiple aggregations.
When I review the original posting, however, I notice two things:
1.The original post says nothing about aggregating anything. The poster only requests a method to turn rows to columns. Granted, many times aggregation is assumed from there, but thatβs not always needed.
2.The original post also says, "Note: Using SQL SERVER 2000β, in which case PIVOT is out of the question anyway. π
Regardless, I think this thread has had some very interesting and very good discussion.
December 28, 2007 at 7:39 am
You are absolutely right this conversation has deviated from the original post. I went off tangent, in my rant about PIVOT π
December 28, 2007 at 1:05 pm
... and PLEASE DON'T DOUBLE POST!!!!
http://www.sqlservercentral.com/Forums/Topic436570-338-1.aspx
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply