Quote
i want to add a column that will estimate the end time of all the procceses, the logic to this is that if (P1 from the order) > (than standard time of P1) true: add (P1 from the order) to FechaRegistro else:add (P1 std time) to FechaRegistro and the result of that would go to the same logic for P2, to finally get the estimated time.
Much in your description of your new requirement befuddles me ...
1. "...if (P1 from the order) > (than standard time of P1) true..."
In the query you posted, P1 is ...
if( min(tiempoinicio)=max(tiempoinicio),
sec_to_time(timestampdiff(second, min(tiempoinicio), now())),
sec_to_time(timestampdiff(second, min(tiempoinicio), max(tiempoinicio)))
) as p1
I see no mention of the ordenes table in that query clause.
By the way, that query clause simplifies to ...
sec_to_time( timestampdiff( second,
min(tiempoinicio),
if( min(tiempoinicio)=max(tiempoinicio),
now(),
max(tiempoinicio)
)
)
) as p1
2. "...add (P1 from the order) to FechaRegistro ..."
Presumably this does not mean to update ordenes.fechoregistro. but What
does it mean?
3. "...the result of that would go to the same logic for P2 ..."
Same problems: p2 doesn't mention ordenes, and what's to be added to what is not at all clear.