select column1, column2
from tablea a, tableb b
where (a.column1 = b.column1
or a.column2 = b.column2)
--- OR ---
select column1, column2
from tablea a, tableb b
where a.column1 = b.column1
and a.column2 = b.column2
--- OR ---
Use an inner join.
-----Original Message-----
From: Mugasundaram Shan
[mailto:mssqldba-ezmlmshield-x18645145.[Email address protected]
Sent: Friday, March 31, 2006 9:43 AM
To: LazyDBA Discussion
Subject: compare table
Hi gurus
I need to compare first 2 columns of two table and output only those
duplicate rows. How can I do that
Thanks
"The information in this e-mail and in any attachments is confidential and intended solely
for the attention and use of the named addressee(s). This information may be subject to legal,
professional or other privilege and further distribution of it is strictly prohibited without
our authority. If you are not the intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any part of it, and should notify us
immediately.
This footnote also confirms that this email has been automatically scanned for the presence
of computer viruses, profanities and certain file types."
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
_________________________________________________________________________
This message and any attachments may be confidential or privileged and are for the exclusive use of the intended recipient. If you are not the addressee or intended recipient, please do not read, copy, use, or disclose this communication to others. If you have received this in error, please notify the sender by replying to this message, and then delete it entirely from your system. Delivery of this message and any attachments to any person other than the intended recipient(s) is not intended in any way to waive confidentiality or a privilege. All personal messages express views only of the sender, which are not to be attributed to Finish Line and/or any of its subsidiaries or affiliates, and may not be copied or distributed without this statement.
MS Sql Server LazyDBA home page