Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to CREATE table #1113 - A table must have at least 1 column

I dont know why I am getting this error, I think this morning i ran this query without errors and it worked.. I am trying to merge two different tables into one table, the tables have the same fields, but different values.

I am using:

create table jos_properties_merged engine = MERGE UNION =
(mergecasas.jos_properties_contacts,viftestdb.buu_properties_contacts);

And i get

"#1113 - A table must have at least 1 column "

DO you know what I am doing wrong, please?

like image 216
ol30cean0 Avatar asked Dec 06 '25 03:12

ol30cean0


1 Answers

according to this link you need to specify the exact same columns existing in your 2 tables:

CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, message CHAR(20)) ENGINE=MyISAM;

CREATE TABLE t2 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, message CHAR(20)) ENGINE=MyISAM;

INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1'); mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');

CREATE TABLE total ( -> a INT NOT NULL AUTO_INCREMENT, -> message CHAR(20), INDEX(a)) -> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;

like image 149
Sebas Avatar answered Dec 08 '25 16:12

Sebas