I am trying to update a lead table to assign a random person from a lookup table. Here is the generic schema: TableA (header), ID int, name varchar (30)
TableB (detail), ID int, fkTableA int, (foreign key to TableA.ID) recordOwner varchar(30) null other detail colums..
TableC (owners), ID int, fkTableA int (foreign key to TableA.ID) name varchar(30)
TableA has 10 entries, one for each type of sales lead pool. TableB has thousands of entries for each row in TableA. I want to assign the correct recordOwners from TableC to and even number of rows each (or as close as I can). TableC will have anywhere from 1 entry for each row in tableA or up to 10.
Can this be done in one statement? It doesn't have to be. I can't seem to figure out the best approach for speed. Any thoughts or samples are appreciated.
Aucun commentaire:
Enregistrer un commentaire