17.05 - Example: Function Mapping with Multiple ANY IN TABLE Clauses - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1144-175K
Language
English (United States)

This function mapping definition includes two ANY IN TABLE clauses.

During function processing, the first two ON clauses that do not have correlation names correspond to the two ANY IN TABLE clauses.

CREATE FUNCTION MAPPING user_Attribution
   FOR attribution MAP JSON ( '{ "function_version": "1.0" }') 
   USING
      ANY IN TABLE,
      ANY IN TABLE,
      conversion IN TABLE,
      excluding IN TABLE,
      optional IN TABLE,
      model1 IN TABLE,
      model2 IN TABLE,
      EventColumn, TimestampColumn, WindowSize;
This SELECT statement includes two ON clauses do not have correlation names: :
  • attribution_sample_table1
  • attribution_sample_table2

These tables correspond to the two ANY IN TABLE clauses of the user_Attribution function mapping.

SELECT * FROM user_ATTRIBUTION(
    ON attribution_sample_table1 PARTITION BY user_id 
                                 ORDER BY time_stamp
    ON attribution_sample_table2 PARTITION BY user_id 
                                 ORDER BY time_stamp
    ON conversion_event_table AS conversion DIMENSION
    ON excluding_event_table AS excluding DIMENSION
    ON optional_event_table AS optional DIMENSION
    ON model1_table AS model1 DIMENSION
    ON model2_table AS model2 DIMENSION
USING
    EVENT_COLUMN_NAME ('event')
    TIMESTAMP_COLUMN_NAME ('time_stamp')
    WINDOW('rows:10&seconds:20')
    ) as dt ORDER BY user_id, time_stamp;