I met the problem:
First two different table fields (Err) caused by 1222 - The informs The SELECT statements have a company's number of columns
Then don't know how to insert said results source table name field
I want to consult the business only through the SQL statement to achieve this? If you can do to achieve?
Structure is as follows:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- Table structure for advert_carousel
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The CREATE TABLE ` advert_carousel ` (
` advert_carousel_id ` int (11), NOT NULL AUTO_INCREMENT COMMENT 'by advertising logo,
` biz_user_id ` int (11), NOT NULL COMMENT 'corporate identity',
` file_lib_carousel ` int (11), NOT NULL COMMENT 'image identification,
` start_time ` datetime NOT NULL COMMENT 'start time',
` end_time ` datetime NOT NULL COMMENT 'end time,
` create_time ` datetime NOT NULL COMMENT 'creation time,
` modify_time ` datetime DEFAULT NULL COMMENT 'last modified time,
` redirect_url ` varchar (255) the DEFAULT NULL COMMENT 'jump URL,
` industry_id ` int (11) the DEFAULT NULL COMMENT 'scope; Industry identity; Left blank for the home page ',
` status ` varchar (20) NOT NULL DEFAULT 'activation' COMMENT 'status; The activation=activation; Invalid=failure; Does=removed ',
PRIMARY KEY (` advert_carousel_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- Table structure for advert_recommend
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The CREATE TABLE ` advert_recommend ` (
` advert_recommend_id ` int (11), NOT NULL AUTO_INCREMENT COMMENT 'identity',
` biz_user_id ` int (11), NOT NULL COMMENT 'corporate identity',
` industry_id ` int (11), NOT NULL COMMENT 'industry logo,
` start_time ` datetime NOT NULL COMMENT 'start time',
` end_time ` datetime NOT NULL COMMENT 'end time,
` create_time ` datetime NOT NULL COMMENT 'creation time,
` modify_time ` datetime DEFAULT NULL COMMENT 'last modified time,
` click_count ` int (11) the DEFAULT '0' COMMENT 'total clicks,
` status ` varchar (20) NOT NULL DEFAULT 'activation' COMMENT 'status; The activation=activation; Invalid=failure; Does=removed ',
PRIMARY KEY (` advert_recommend_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CodePudding user response:
seledct advert_carousel_id, biz_user_id file_lib_carousel, null as ndustry_id
The from advert_carouse
Union all
Seledct advert_carousel_id biz_user_id, null as file_lib_carousel, ndustry_id
The from advert_recommend