Combining Values from Adjacent Rows - Aster Analytics

Teradata Aster Analytics Foundation User Guide

Product
Aster Analytics
Release Number
6.21
Published
November 2016
Language
English (United States)
Last Update
2018-04-14
dita:mapPath
kiu1466024880662.ditamap
dita:ditavalPath
AA-notempfilter_pdf_output.ditaval
dita:id
B700-1021
lifecycle
previous
Product Category
Software

This SQL-MapReduce call gets the pageid for each row and the pageid for the next row in sequence:

SELECT sessionid, pageid, next_pageid FROM nPath (
  ON clicks1
  PARTITION BY sessionid
  ORDER BY ts
  MODE (OVERLAPPING)
  PATTERN ('A.B')
  SYMBOLS (true AS A, true AS B)
  RESULT (FIRST(sessionid OF A) AS sessionid,
    FIRST (pageid OF A) AS pageid,
    FIRST (pageid OF B) AS next_pageid
  )
);