0
Hello guys I’m new with mysql code manipulation, I need to help to create a numerical sequence in the registration and registration columns, note: the records have to be equal in both columns! Note: I want to repeat the information of the other columns generating the sequence only in initial record and final record, both columns as the same sequence number Thanks in advance!
INSERT INTO tabela ('empresa','nome', 'telefone', 'registro_inicial', 'registro_final', 'id_venda', 'justificativa', 'data_inserido', 'protocolo')
VALUES (1, 'Joao', '99999-0000', '', '', 'Venda no crediario', '2020-11-04 15:43:09', NULL);
WHERE registro_inicial > 000001
AND registro_final <100000
So I want to keep the records of the other columns and put a numerical sequence in the columns registe_initial and registro_final and through this sequence generate the number of rows according to the sequence set, I do not know if I was clear.
– Ricardo JM Sistemas
Ai Voce has to update and not an Insert. UPDATE NOME_DA_TABELA SET field1 = value1, field2 = value2 WHERE field1 = 'value';
– Willian Ferrera
So in the update I will duplicate the other information? generating new numbers in sequence in the initial and final registration columns? because not only do I need to change, I need to generate new rows repeating all information from the other columns and new information, only in the initial and final registration columns.
– Ricardo JM Sistemas
in the update the other columns will have the same value. Everything you pass after the set is what you will update. In the case there, initial record and final record where (Where) the initial record greater than 000001 and final record < 100000.
– Willian Ferrera
I get it, I’m gonna do it here, and I’m gonna warn you
– Ricardo JM Sistemas
Do you want to duplicate the other information? Do you want to insert a new row into the table would that be? In this case there is no simple way to do it. You’d have to use a programming language to make that rule.
– Willian Ferrera
That’s right, I want to duplicate the other information by inserting new lines, following the sequence set in the two columns starting record > 000001 and end record < 100000
– Ricardo JM Sistemas
Let’s go continue this discussion in chat.
– Willian Ferrera