The tables impressions and clicks have a user_id column, but the table tv_spots is only a record of television advertisements shown, which any user might have seen. Therefore, tv_spots must be a dimension table.
SELECT * FROM npath ( ON impressions PARTITION BY userid ORDER BY ts ON clicks2 PARTITION BY userid ORDER BY ts ON tv_spots DIMENSION ORDER BY ts MODE ('nonoverlapping') SYMBOLS (true as imp, true as click, true as tv_imp) PATTERN ('(imp|tv_imp)*.click') RESULT (COUNT(* of imp) as imp_cnt, COUNT (* of tv_imp) as tv_imp_cnt) ) ORDER BY imp_cnt;