Another version of improved widget of active users

This is the new commit for issue #11107
Now it uses subquery with nested sorting and must work on any type of database.

I have table with 45000 records and when I select last actions for 50 hours this query takes only 0.0287 sec.