Write a SQL query to identify the most common paths users take before abandoning a conversational session at Moveworks.Ai. Use the supplied session, user, and event data. Consider only events occurring before abandonment and return the most frequent complete paths.
path_rank, conversation_path, abandoned_sessions, and distinct_users.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | Display name of the user |
| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique conversational session identifier |
| user_id | INT | User who initiated the session |
| status | VARCHAR(20) | Session outcome such as abandoned, completed, or active |
| started_at | TIMESTAMPTZ | Session start timestamp |
| abandoned_at | TIMESTAMPTZ | Timestamp when the session was abandoned |
| Column | Type | Description |
|---|---|---|
| session_event_idPK | INT | Unique event collection identifier |
| session_id | INT | Session associated with the event collection |
| events | JSONB | Ordered event objects containing event_type and event_at |