LAST Example 1 - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Assume the following query runs on the employee table PERIOD(DATE) column period1:

SELECT * FROM employee WHERE LAST(period1) = DATE '2004-01-04';

The employee table contains:

ename   dept          period1
-----   -----------   ----------------------------
Jones   Sales         ('2004-01-02', '2004-01-05')
Adams   Marketing     ('2004-06-19', '2005-02-09')
Mary    Development   ('2004-06-19', '2005-01-05')
Simon   Sales         ('2004-06-22', '2005-01-07')

The result is:

ename   dept          period1
-----   -----------   ----------------------------
Jones   Sales         ('2004-01-02', '2004-01-05')