0
I need to update a table with 13,000 lines. And this table contains a field called "faixa_cep_id" and all ids are 0. I need to update this with a loop to not duplicate the fields (EX: 1, 2, 3, 4...). Someone could help me out?
DROP TABLE IF EXISTS `pl_joseanmatias_faixa_cep_peso`;
CREATE TABLE `pl_joseanmatias_faixa_cep_peso` (
`faixa_cep_id` int(11) NOT NULL,
`title` varchar(150) NOT NULL,
`weight_min` float NOT NULL,
`weight_max` float NOT NULL,
`postcode_min` int(11) NOT NULL,
`postcode_max` int(11) NOT NULL,
`cost` float NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Does the data you want to enter come from another table? If so, is there a relationship between the table you want to change and the table where the data is? Your question has become vague, specify with an example.
– Rafael Salomão
@Rafaelsalomão does not... I want you to start inserting ids automatically by counting from 1. Getting: 1 2 3 4 But without interfering with the other fields in the table...
– Ádanny Silva Mota
Ahhhh, do you want an auto-increment field? That is, faixa_cep_id account from 1 to 13 thousand correct?
– Rafael Salomão
@Raphael Read this :D
– Ádanny Silva Mota
@Rafaelsalomão made a mistake. I tried to mark you down there but I couldn’t
– Ádanny Silva Mota
@Rafaelsalomão updated the post with an sql for table creation
– Ádanny Silva Mota
@Rafaelsalomão and how I do it?
– Ádanny Silva Mota
I don’t see auto-increment column in your table. Did you set the attribute : faixa_cep_id as index? It has to be an index of your table. I posted down there how it creates the Dice.
– Rafael Salomão
@Rafaelsalomão #1062 - Duplicate '0' input for faixa_cep_id key'
– Ádanny Silva Mota
Because the entry I have set is of type Dice unico and its column contains duplicate values. create a single entry : "ALTER TABLE
faixa_cep_id
ADD INDEXID
(ID
); " also works.– Rafael Salomão