Hi folks,

I've simplified the description of the problem but basically here's what I
need to do: given a group of people working for a number of different
divisions of a company I need to split those people into small teams,
ideally with no more than one person from each department in the same team.

For example, if the employee directory looked like this:

Anne - Finance
Bill - Sales
Chris - Marketing
David - Finance
Ewan - Sales
Fred - HR
Gail - Sales
Harry - Finance
Ian - Finance

I would like them to be grouped into teams of 3 (where the number of people
and the number of people in each team can both vary depending on the
requirements at the time) like so:

Team 1
Anne - Finance
Bill - Sales
Chris - Marketing

Team 2
David - Finance
Ewan - Sales
Fred - HR

Team 3
Gail - Sales
Harry - Finance
Ian - Finance

The ordering isn't important - in fact I'd prefer the distribution to be as
random as possible. I want to try and avoid multiple people from the same
department in the same team, which is obviously impossible in the case of
one of the departments.

I'm not too worried about having people left over after the teams have been
generated as I can handle that separately.

Can this be done using SQL (SQL Server stored proc) alone or do I need to
pull the data out in a record set, loop over it and then insert the "teams"
as necessary (SQL Server Stored proc or a series of standalone CFQUERY
tags)?

If anyone can provide any pointers, examples or URLs it would be most
appreciated!

Thanks in advance,

Colin
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to