Home My Account

Select from two tables SQL

September 26, 2018

Basic

SELECT table1.column1, table2.column2 FROM table1, table2 WHERE table1.column1 = table2.column1;

Join

SELECT table1.column1, table2.column2 FROM table1 INNER JOIN table2

ON table1.column1 = table2.column1;

Subqueries

SELECT column1 FROM table1 WHERE EXISTS ( SELECT column1 FROM table2 WHERE table1.column1 = table2.column1 );