ANSI | DB2 | SQL/DS | XDB |
---|---|---|---|
X | X |
This function (also XMONTH) extracts the month from a date or timestamp. The format appears below:
MONTH(date-expr)
For example, a query lists the quantity of parts ordered in January:
SELECT p_no, SUM(quantity) FROM orders WHERE MONTH(o_date) = 1 GROUP BY p_no