如果可能的话,我想在加入这两个表之后创建一个新表
SELECT * FROM tablepeople
JOIN tableinfo
ON tablepeople.id = tableinfo.ctrlid
答案 0 :(得分:3)
是的,您可以使用下面的CREATE TABLE AS ... SELECT FROM
构造;考虑new_table
已经存在
create table new_table as
SELECT * from tablepeople
join tableinfo
on tablepeople.id = tableinfo.ctrlid
答案 1 :(得分:0)
CREATE TEMPORARY TABLE [table_name] ( [query] );
OR
CREATE TABLE [table_name] ( [query] );
答案 2 :(得分:0)
您可以使用
创建表new_table
Create table new_table as
SELECT * FROM customers
LEFT JOIN orders ON customers.idcustomers = orders.idorders
UNION
SELECT * FROM customers
RIGHT JOIN orders ON customers.idcustomers = orders.idorders;