Examples: Distinguish between Multiple Candidate Columns - Advanced SQL Engine - Teradata Database

Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
zzg1600277315070.ditamap
dita:ditavalPath
zzg1600277315070.ditaval
dita:id
B035-1208
lifecycle
previous
Product Category
Teradata Vantageā„¢

When there are multiple candidate columns that can be inferred to be the timecode column, the USING TIMECODE clause provides a way to disambiguate which to use; for example, when there are joins between PTI tables. If the USING TIMECODE clause is not specified in ambiguous cases, an error is reported.

Example: USING TIMECODE Clause with Multiple Candidate Columns

The example shows explicitly specifying the USING TIMECODE clause in a join:

select avg(b.temperature)
from ocean_buoys_seq a , ocean_buoys_seq b
group by time(minutes(100))
using timecode(a.td_timecode); 

Example: Invalid Example with Ambiguous Multiple Candidate Columns

The example shows that the timecode is ambiguous without specifying the USING TIMECODE clause in this join:

select avg(a.temperature)
from ocean_buoys_seq a, ocean_buoys b
group by time(minutes(100));

 *** Failure 4359 Time Series: Timecode specification is ambiguous.