Hi,
I have been given the following request.
Please give 7% of the current contacts registered to each of the sales associates to the new sales associate ('Peter').
What I decided to do was to get the total records for each sales associate and calculate 7% of the records.
For example David has 200 200/7% = 14
SELECT TOP 14 ContactAssociate
FROM tb_Contact
WHERE tb_Contact.ContactAssociate = 'David'
ORDER BY NEWID()
Now, I can select the data but am struggling to update them; I thought this would do it but no joy.
UPDATE tb_Contact
SET ContactAssociate = 'Peter'
IN
(
SELECT TOP 14 ContactAssociate
FROM tb_Contact
WHERE tb_Contact.ContactAssociate = 'David'
ORDER BY NEWID()
)
Any ideas where, I'm going wrong? Any help, much appreciated.