User Id :    Password :      New Member   Forgot Password  
Topic: Write a query when we need a common row between two tables ?
Anamika singh
11 Oct 2010 at 03:16 AM
Write a query when we need a common row between two tables ?
Re: Write a query when we need a common row between two tables ?
Gaurav
12 Oct 2010 at 03:16 AM

We use intersect to do this

SELECT col1,col2,col3 FROM table1
INTERSECT
SELECT col1,col2,col3 FROM table2

Intersect is some time like the inner join but inner join can give the duplicate values but intersect not give the duplicate values this is the main difference between inner join and intersect. In this way, INNER JOIN can simulate with INTERSECT when used with DISTINCT.

Total Replies: 1
 
Featured Text Ad

Featured Ad