Hacker News new | ask | show | jobs
by bgilroy26 5103 days ago
In a typical data environment for an event table, you can have a user_history table with the unique_primary_key, timestamp, user_id, attribute_column_name, Previous_value, and Subsequent_value.

If you want to know what users who did X and later did Y, couldn't you select all of the users who did X in a subquery and then find out how many of those user_id's match user_id's of people who did Y, where the timestamp on Y is between the X's timestamp and X's timestamp + some_predetermined_amount_of_time?

I am out of my depth, but isn't there some database best practice for tracking user session start and stop times?

Edit: I wrote this comment before I saw a different comment of yours above, which I think answers my question.