5
I already made this account and it works right in C++. My problem is to do inside a select to appear in the table. If someone wants to see the C++ algorithm to help mount in Mysql I can send.
This is my chart:
Fields after state are custom_fields created by me
I need to create 4 more Fields.
• The total time the state is at 0.
• The total time the state is above 0.
• The percentage he stood at 0 and another.
• The percentage that the state stood above 0.
As you can see it only appears at the time the state has changed. So I need to take state time and subtract by the time of the previous state different. If you have two lines with the same state, consider only the time of the first row of the state repeated to be subtracted. The result of these subtractions will be summed and will generate a total time at the end.
On the last line, I have to take the total time and subtract from the current time, because the last line of the query is the current state.
The calculation of hours and percentages should be separated by object_id.
At the end I have to group the table by object_id to bring in the screen jqgrid.
If I’m not clear, you can comment, I’ll try to explain better.
I was thinking that a good solution would be to use variables and functions, but as I’m new I don’t have much knowledge of it. If someone knows of any booklet or course that explains well about these subjects, can indicate.
Hello Victor. Table image opening? What I need actually is to sum up all the times that the state is at zero and all the times that the state is different from zero and show the total result of each. And then the percentage of time the state was at 0 and higher than 0.
– FabricioCani