16.10 - Example 5: Find First Product with Multiple Referrers in Any Session - Teradata Database

Teradata Analytic Functions

prodname
Teradata Database
vrm_release
15.10
16.10
created_date
November 2017
category
Programming Reference
featnum
B035-1206-151K

SQL-MapReduce Call

SELECT * FROM NPATH (
   ON aggregate_clicks
   PARTITION BY sessionid
   ORDER BY clicktime
   USING
   MODE (nonoverlapping)
   PATTERN ('REFERRER{2,}')
   SYMBOLS (referrer IS NOT NULL AS REFERRER)
   RESULT (FIRST(sessionid OF REFERRER) AS sessionid,
   FIRST(productname OF REFERRER) AS product)
) as dt ORDER BY dt.sessionid;

Output

nPath Range-Matching Example 5 Output Table
sessionid product
1 envelopes
2 tables
3 bookcases
4 tables
5 Appliances