as briefly explained in subject, I need to create a table by selecting existing value.
The thing I would like to achieve is to have another column with auto incremented value.
This is what I already tried:
CREATE TEMPORARY TABLE temp_tb (
`row_id` bigint(20) NOT NULL AUTO_INCREMENT,
`stm_id` bigint(20) NOT NULL,
descr varchar(20) NOT NULL,
PRIMARY KEY (row_id)
);
Then after with a select:
INSERT INTO temp_tb (
select stm_id,descr from tb_export
)
I was expecting to have the row_id column prefilled at insert time, but I just got sql syntax error telling me that column count doesn’t match value count.
Do you know if this is possible to achieve ?
thanks
you should provide the names of the columns you are inserting into your temp_tb: