Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> dividing to group with the same weight

dividing to group with the same weight

From: <liorlew_at_gmail.com>
Date: 8 Feb 2006 07:52:33 -0800
Message-ID: <1139413953.478389.117520@g14g2000cwa.googlegroups.com>


Hello,

I would like to write a query (probably with analytic functions) that when given the 'weight' (for example salary) , it distributes the salary between X groups with the same (more or less) weight.

example:
1,2,1,4,4,2,30,1,2,7,3,9,1 (X=3)

30        9       7
            4       4
            2       3
            1       2
            1       1
            1

-------------------------
30       18     18

the algorithm that I am using is:
1. sort the weight in a descending order 2. put the entry in the group with the less weight.

when dealing with a very large number or records, the result will be group with more or less the same weight.

thanks
Lior Received on Wed Feb 08 2006 - 09:52:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US