# Database Discussions > Microsoft SQL Server 2005 >  non matching rows display

## chariprasanna

Table1

TopicId      TopicName  BusinessUnit     Rank

    1               T1                BU1               1
    2               T2                BU1               2
    1               T1                BU2               1
    2               T2                BU2               2

Table2

TopicId      TopicName  BusinessUnit     Rank

    1               T1                BU1               1
    2               T2                BU2               2

Here i want to display nonmatching rows from first table.Plz urgent

----------


## rmiao

Have pkey on those tables?

----------


## srikanth.mss

select * from table1 t1
where not exists
(
select 1 from table2 t2
where t1.topicid = t2.topicid and
t1.topicname = t2.topicname and
t1.businessunit = t2.businessunit and
t1.rank = t2.rank
)

Regards,
Srikanth
SSE,
OCA.

----------

