Skip to content
Advertisement

postgresql – condition met in a time interval

I have the following table and I want to create the condition_met column. The condition_met column is my expected output.

Condition_met is TRUE when type_id = 34 and within 5 seconds after this type_id, the client_id of type_id = 34 becomes also prospect_id.

To say it differently: for each type_id = 34 the client_id that performed action type_id = 34 needs to become prospect_id in 5 seconds

Advertisement

Answer

Does this query OK for you ? (Resul here)

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement