Concurent user(not postgres user) login issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • montazsy
    New Member
    • Jan 2023
    • 1

    Concurent user(not postgres user) login issue

    Hi everyone!

    I have a problem that I should solve in postgres sql, but I'm stuck.
    The bare data is a table named activity_logs : activity_time (timestamp) | action (int4)|item 1 (varchar) | item 2 (varchar)|
    This is a log table simplified.
    activity_time: is a timestamp when a user login/logout is attempted.
    Action: can be 1 - Login or 2 - Logout.
    item 1: some product info (should be in the group by)
    item 2: some other product info (should be in the group by)

    The desired statement that I want to know from it:
    When were most users logged in concurrently by item1, and by item 2?

    I tried several ways but each has an inaccuracy. With rounding, with series, with normal select in select, for select, but hopelessly. I can't find an exact way, how to say exactly the correct aggregated number of users for each item 1 item 2 when the most user logged in.

    Any idea is appreciated.
Working...