qinyan
asked on
How to calculate Median for each group from a large set of data?
I know how to calculate Median from Ken's book 'The Guru's Guide to Transact-SQL', but the example given in the book only deals with one set (group) of numbers. In my case, I need to group by each code and before group by I have a total of 18 million records so using cross join (one way talked about in the book to get Median) might take a long time. If using Identity, i wonder how to insert id which starts 1 again when a new group starts. Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tested on a db running on SQL 2005 and it worked. Thanks!
ASKER