nPath Example | Teradata Vantage - nPath Example: First Product with Multiple Referrers - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example finds the first product with multiple referrers in any session.

SQL Call

SELECT * FROM NPath@coprocessor (
  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;

Output

 sessionid product    
 --------- ---------- 
         5 appliances
         4 tables    
         2 tables    
         3 bookcases 
         1 envelopes

Download a zip file of all examples and a SQL script file that creates their input tables.