MySQL Forums
Forum List  »  Newbie

Re: Aggregate with comparison
Posted by: Peter Brawley
Date: September 30, 2015 03:23PM

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.

Options: ReplyQuote


Subject
Written By
Posted
September 29, 2015 12:41PM
September 29, 2015 04:23PM
September 30, 2015 12:45PM
Re: Aggregate with comparison
September 30, 2015 03:23PM
September 30, 2015 03:45PM
October 01, 2015 10:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.