I have a query that is working fine, it creates one MySQL table from another based on selected fields.
My problem is I also want 2 new empty columns in the new table.
How do I create a new table based on an existing table, but with added empty columns?
$result = mysqli_query($mysqli,"CREATE TABLE matchstats SELECT hometeam, fthg, awayteam, ftag FROM results");
if (!$result) {
die("Query to create table failed");
}
You can try this
CREATE TABLE table2 (
new_column1 DECIMAL(5,2),
new_column2 DECIMAL(5,2)
) SELECT * FROM table1 ;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments