• Here is a simplified version of the task:

    Table Lottery

    AcctNo varchar(16)

    Cycle varchar(2)

    Bal numeric(9,2)

    EmpNo varchar(6) - starts as null - want to assign empno's to this field randomly

    Table Emp

    EmpNo varchar(6)

    Cycle varchar(2)

    I need to assign empno's to accounts matching on cycles (think of cycles as teams). I need to make sure that employees get ~ the same number of accounts and average balances. On days where there are fewer accounts to assign than employees in that cycle, I still have to assign - so in that case the assignment still has to be random, except that no employee who 'wins the lottery' should get more than one account.

    J. Moseley

    [font="Courier New"]ZenDada[/font]