views:

67

answers:

4

How can I select rows that exist is two tables. The intersection I guess? Any help?

ProductosA and ProductosB, they're both tables with the exact same number and type of columns.

How can I select the things that are inside of both using a single select statement?

A: 

Simply by specifying more than one table in your FROM clause you will get rows that exist in more than one table. Whether you get their entire rows, or just part of them, depends on how many of the columns you specify in the SELECT clause.

Rafe Lavelle
+1  A: 

If there is a primary/composite key join the two tables where the keys match, if there is no primary key, join them using where "and"ing match for each column.

Murali VP
A: 
select a.column1, a.column2
from productosA a
join
productosB b
on
a.id = b.id

that will give you what you want

roman m
@rexem: my formatting is easier to read
roman m
+2  A: 

Try:

select * from ProductosA
intersect
select * from ProductosB
;
Rob Farley