Today, there is a seemingly simple but very tangled problem, but finally solved the
I'm using Oracle based on a lot of things that are available online, specific stickers
This is the field of the login table, which inserts the user's ID login time when each user logs in
Now the user wants to show the last logon time how to take?
Here's the flashback of the landing time.
If you take the latest login time as follows
But how to take the last login record (that is, the second one after the flashback)? Online offers a lot of is to let rownum=2, but the results are greatly unexpected
It is empty value, that is, and not to take it, but if you change to rownum<=2 can get the first two articles:
I am also very puzzled about what is going on, finally can only take the 2 data to do a sort, take the first one,
Although this is taken out but the total feeling of some discomfort, there should be a more feasible way, I hope the great God to give guidance.
Another doubt is that if you look directly at ROWNUM the result is:
It is because he is not in the order of time to gradually increase, so even let rownum=2 go to the wrong.
Hope that the way the great God pointing Maze!!!
Reproduced please indicate the original, thank you!
Query user last logon time issue