17.10 - nPath Resultの例: ある行の値と次の行の値との結合 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Advanced SQL Engine分析関数

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
2021年7月
Content Type
プログラミング リファレンス
Publication ID
B035-1206-171K-JPN
Language
日本語 (日本)

入力

入力テーブルは、nPath Filterの例にあるようにクリックストリームです。

SQL呼び出し

SELECT * FROM nPath (
  ON clickstream PARTITION BY userid ORDER BY userid, sessionid, clicktime
  USING
  Mode (OVERLAPPING)
  Pattern ('A.B')
  Symbols (TRUE AS A, TRUE AS B)
  Result (
    FIRST (sessionid OF A) AS sessionid,
    FIRST (pagetype OF A) AS pageid,
    FIRST (pagetype OF B) AS next_pageid
  )
) ORDER BY sessionid;

出力

sessionid pageid next_pageid
1 home view
1 view view
1 checkout view
1 checkout checkout
1 view checkout
1 view view
2 checkout view
2 home view
2 view view
2 view checkout