how to select data from two tables in sql without join code example
Example 1: join multiple tables sql
SELECT TableA.*, TableB.*, TableC.*, TableD.*
FROM TableA
JOIN TableB
ON TableB.aID = TableA.aID
JOIN TableC
ON TableC.cID = TableB.cID
JOIN TableD
ON TableD.dID = TableA.dID
WHERE DATE(TableC.date)=date(now())
Example 2: sql select from multiple tables without join
SELECT emp_name AS name from employees
UNION
SELECT cust_name AS name from customers;
SELECT emp_name AS name from employees
UNION ALL
SELECT cust_name AS name from customers;
Example 3: sql combine results from two tables
SELECT *
FROM tutorial.crunchbase_investments_part1
UNION
SELECT *
FROM tutorial.crunchbase_investments_part2