Previous Topic Next topic Print topic


YEAR

ANSI DB2 SQL/DS XDB
  X   X

The YEAR function (also XYEAR, XDB mode only) extracts the year from a date or timestamp. The format appears below:

YEAR(date-expr)

For example, the following query finds all employees born the same year as employee Smith:

SELECT lname FROM bdaylist
WHERE YEAR(birth) IN
  (SELECT YEAR(birth) FROM bdaylist
  WHERE lname = "SMITH")
Previous Topic Next topic Print topic