• Hi there,

    hmmm, sounds to me that you only needed 1 record to be return?? Correct me if i'm wrong, in SQL Server there is nothing such as "groupdistinctcolumns", but there are workarounds to this, one way i suggest is to use temp table to temporary store grouped data (might not yet be distinct) and then query the temp table with a where cause + DISTINCT keyword.

    For your case, Y not use TOP??

    SELECT TOP 1

    T1.[id], T1.[name] AS nameA, T2.[name] AS nameB, T2.[addr] FROM T1 INNER JOIN T2 ON T1.ID = T2.FK WHERE T2.[name]='AAA'

    then only 1 record will be returned.

    Cheers ;),

    Jon