Hi ,
Try this code
SELECT ClientId,Performance,Date FROM
( SELECT ROW_NUMBER() OVER (PARTITION BY Performance ORDER BY ClientD DESC) AS 'RowNumber',
CleintId,Performance,Date FROM @tempContacts) dt WHERE
dt.RowNumber <=12 ORDER BY Performance,CleintId.
Regards
Damu