Examples: GROUP BY TIME with Multiple Sources in a Query - Analytics Database - Teradata Vantage

Time Series Tables and Operations

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢

When there are multiple possible sources in a query, only PTI tables are considered when the database is inferring the timecode column. The TD_TIMECODE column is inferred by the database only when it is not ambiguous.

Example: Multiple Sources in a Query

In the example only ocean_buoys is considered when inferring the timecode, so no USING TIMECODE clause is necessary.

sel avg(a.temperature), mode(b.temperature)
from ocean_buoys a inner join ocean_buoys_nonpti b
on a.buoyid = b.buoyid
group by time(minutes(10));

Example: Invalid Example with Ambiguous Timecode Specification

In the example, TD_TIMECODE is ambiguous so it cannot be inferred and an error is reported. Because both join tables have TD_TIMECODE, USING TIMECODE is required to specify which TD_TIMECODE to use.

sel avg(a.temperature), mode(b.temperature)
from ocean_buoys a inner join ocean_buoys_seq b
on a.buoyid = b.buoyid
group by time(minutes(10));

Result:

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