mysql select from two tables code example
Example 1: mysql join two tables
SELECT user_id, user_name
FROM users
UNION
SELECT organization_id, organization_name
FROM organizations
Example 2: mysql view from multiple tables
CREATE VIEW V AS (
SELECT i.country,i.year,p.pop,f.food,i.income FROM
INCOME i
LEFT JOIN
POP p
ON
i.country=p.country
LEFT JOIN
Food f
ON
i.country=f.country
WHERE
i.year=p.year
AND
i.year=f.year
);