I have the following query:
The question is as follows. In this table there are several interactions of several users in the same transaction. What I need is to get the last user lifetime in the transaction.
For example:
According to the table above, idusers 560049 was the last user to service the transaction. He began service at 2018-09-12T09: 34: 50Z and ended service at 2018-09-12T09: 54: 50Z. The service time in this case is 20 minutes.
What matters to me is always the last user of the transaction.
If I try to put the min and max gives problem because it groups and goes wrong.
And if it is the case the user does not have a end time, I just want to ignore it. As in the example below:
I know the question is complex, but I could not explain it any other way. If any moderator thinks it is unclear, let me know that I am trying to restate the issue.