i have a table that includes profile id, search term, search time stamp, and playback start time i want to create a query that returns something like the table below. I want the get the closest playback time right after a search time is initiated for each profile and search term they used. and if possible calculate time difference . i think i would have to use lag/lead but not familiar with that windows function.
| Profile id | search term | search time | playback time |
|---|---|---|---|
| profile 1 | THE C | 9:01:04 | 9:01:06 |
| profile 1 | THE | 9:01:02 | NULL (edited) |