• ha I knew that was coming. This is a very rudimentry example, but it gives you an idea of the issue

    --create table #test (clientID int,contactID int,firstname varchar(255),lastname varchar(255),linkID int)

    --insert into #test VALUES (1,1,'tim','s',1)

    --insert into #test VALUES (1,1,'tim','s',2)

    --insert into #test VALUES (1,1,'tim','s',2)

    --select * FROM #test

    ;WITH

    keys AS

    (

    SELECT DISTINCT contactID,firstname,lastname,linkID

    ,(SELECt count(*) FROM #test) as allrecords

    FROM #test

    )

    SELECT * FROM keys

    is that enough to make more sense of what I was saying?

    Cheers

    Tim