creating a mysql table from a inner join

╄→尐↘猪︶ㄣ 提交于 2019-12-06 11:52:07

Remove the * in your SELECT statement and actually list out the columns you want in your new table. For columns that appear in both original tables, name the table as well (e.g. sitematrix_databases.database_id).

Don't use * instead name each column and use aliases. For instance instead of sitematrix_database.database_id you can have alternativeName. Also you can pick and choose which columns you want this way as well.

In SQL Server, you can use "select into". This might be equivalent syntax for mySql:

Unfortunately, it's a two commands (not just one):

CREATE TABLE recipes_new LIKE production.recipes; INSERT recipes_new SELECT * FROM production.recipes;

Instead of using SELECT * ... try SELECT database_id ...

MySQL does not like joining tables that have the same column name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!