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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query help -

Author  Topic 

RichH6109
Starting Member

1 Post

Posted - 2007-07-05 : 18:46:28
Hi all - first time poster, go easy on me!

I've just taken on a project that, on the face of it, seems simple but now I get the feeling that it's quite complex (unless I'm just thick). I work as a developer in a customer services environment and I need to split a table equally based on certain variables so that I can feed the workload to operators as fairly as possible.

For example, I have a table (tblCustomers) that contains four rows containing accounts with a variable for age. These could have the values 20, 30, 30 and 40. If I have two operators, I would like to send one operator the accounts with ages 20 and 40 and the other operative the accounts with ages 30 and 30 - therefore they will both work on account 'batches' with an average age of 30.

Obviously, in the real world, I'll have thousands of rows and the ages won't average out as neatly as in the above example. Can anyone help me create 'batches' that are as closely aligned as possible?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-05 : 19:01:16
Yes. Have a look at the algorithm posted here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=80857


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-05 : 19:02:58
What you want to search for is the sum of all ages, divided by number of operators.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -