1
I have an application that I developed a few years ago in a hurry, and then I started working to improve its performance. In this app, there is a part of the process that I perform several actions followed in the database, initially my plan was to put in a trial but I had a problem, which was not able to handle line by line a select in Mysql (for report view)and due to lack of time to study the resolution dealing in the backend directly with python.
Today I have the same scenario, I need to generate a report from data from another table but I need to read line by line and I didn’t want to do it with python, because it would increase processes have some way to do it in a process?
I could make a loop defining the limit
each turn to treat the lines, but wanted to know if it is possible to do with less code, within a process, type:
while (select `acao`,`regiao`,`id`,`data` into @acao, @regiao, @id, @data
from `historico` where `contrato` = '142';) Do
if (@acao == '1') then
insert into movimentacao_acesso (`idm`, `data`, `regiao`) values (@id, @data, @regiao);
end if;
end while;
select * from movimentacao_acesso;
Thanks in advance. I just need to run this loop in the process
In short, you need to take the data from a select with a certain filter (Where) and insert it into another table?
– Daniel Mendes
This are actually different inserts in two different tables depending on the line action.
– Wan