mysql inner join two tables example

Example 1: inner join mysql

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;

Example 2: 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 3: mysql join two tables

SELECT user_id, user_name
FROM users
UNION
SELECT organization_id, organization_name
FROM organizations

Tags:

Sql Example