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
 General SQL Server Forums
 New to SQL Server Programming
 automatic dense rank

Author  Topic 

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2012-10-22 : 17:57:11
hi,

i'm having following sample dataset

; with x as
(
select 12 as vl union all
select 11 as vl union all
select 13 as vl union all
select 10 as vl union all
select 11 as vl union all
select 12 as vl union all
select 14 as vl union all
select 10 as vl union all
select 15 as vl union all
select 14 as vl union all
select 13 as vl union all
select 15 as vl union all
select 13 as vl union all
select 25 as vl union all
select 10 as vl union all
select 13 as vl union all
select 14 as vl union all
select 25 as vl union all
select 94 as vl
)

select count(*), vl
from x
group by vl


where i want to get automatic groupings of the vl (values) based on either dense or ranks.
and outliers are values: 25 and 94.

do you have any other ideas on how to do this?

thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-22 : 18:52:04
so what should be the output?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2012-10-23 : 00:10:24
the output should be the automatic grouping of the variables.

for example:
group 1.: 10
group 2.: 11-12
group 3.: 13
group 4.: above 14
extreme values: 25,94

if I add more values 11 or 12, group 1. would be 10-11, group 2. 12, etc.
Go to Top of Page
   

- Advertisement -