I have a table from our IVR that contains a unique call id, sequence number, event code, and event description. I would like to write a query that let’s me know what was the event prior to a particular event.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on what indexes exist on the table, a straightforward inner join may receive a better-performing access plan from the query optimizer.
The query assumes that any event with a sequence number that differs by one is an appropriate match, and that the call_id doesn’t also need to match. If that assumption is incorrect,
then add
AND n.call_id = p.call_idto the ON clause of the join.