0
I have a table with several repeated names sequenced by another column called id2 where each 1 of these records has a column with a quantity Example :
Name-Quantity-Value2-id2
teste1-1000-0-1
teste1-1100-100-2
teste1-1100-0-3
teste1-1100-0-4
teste1-1100-0-4
teste1-1100-0-4
That means there must be a Procedure where I have to fetch the previous "Quantity" add the current "Valor2" and save record after registration Any reply that might help I appreciate.
Does the table have a primary key? If so, what is the name of the column? In the example, the id2 column has repeated values; this is correct?
– José Diz
Not this correct, I published a perhaps clearer example below
– Bruno Almeida
It seems to me that there are contradictions in the objectives: "seek the previous Quantity to add the current Value2" with "add Quantitya Material + Quantitya - Value2". Could you check?
– José Diz
And when the value of id2 is 1, where there is no previous amount, what to do?
– José Diz
because this is also a problem in php I have something like that limiting the first query where it says that ...###############################Where ... ########= second query
– Bruno Almeida
Vide http://answall.com/questions/180842/como-escrever-um-store-procedure-que-usa-valores-da-linha-atual-e-da-anterior/181261
– José Diz