mysql - I would like to insert into a table using a select query; the select query has an auto-increment field and multiple records -
I know that you can use it:
AUTO_INCREMENT from info_schema.tables Select WHERE table_name = 'myTable' and table_schema = 'myDatabase' If I am inserting a line at a time
but with the key 'primary' An error of duplicate entry will be generated if the selection query returns many records
select myTable (select from info_schema.tables AUTOCREMENT from WHOE table_name = 'myTable' and table_schema = ' myDatabase ') Customer_ID, myTable2 client, where the customer is '% Tech%'
Easy:
Choose from Meritबेस 2 customer in INSERT Merchant (customer) '% Tech%' like customer ' : -)
Editing (Explanation): This is the correct meaning of AUTO_INCREMENT, you can just leave it out and it can get an unused number, I think you can also give zero as value, which is translated as "next not Free price will be. "
However with @Varials you can easily create line numbers and similar, but it has been kept for more interesting questions.
Comments
Post a Comment