I am trying to create a flag that looks back 7 days for a date column and if there is a row within that partition then true if there is no row returned within that 7 days then false.
Can a window function accomplish this? most windowing function seem to operate on rows and not column values.
checkout sample data There are a bunch of messeage_ids and then has an event of open then a timestamp. for each row i need to look back 604800 seconds and see if any rows exist within the message_id partition.
Something like this would work for many databases:
If you want to use window functions, then look at lead(). With lead() it would look like: