简体   繁体   中英

Join 4 tables into a single table in phpmyadmin

I have 4 tables which contain multiple values. As of now I am manually combining the values of all the tables into a single table ie exporting the values of all 4 tables in xlsx format and making another excel document and putting those values and uploading them to a new table. So this is what I'm doing right now to fetch the values.

$sql = "SELECT * FROM foodDatabase";

I want something like this

SELECT * FROM TABLE1 AND TABLE2 AND TABLE3 AND TABLE4;

SQL UNION Operator

SELECT * FROM TABLE1
UNION 
SELECT * FROM TABLE2 
UNION 
SELECT * FROM TABLE3
UNION 
SELECT * FROM TABLE4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM