Quantcast
Channel: Toad for IBM DB2 Forum - Recent Threads
Viewing all articles
Browse latest Browse all 389

RE: DB2 - First And Last Day Of Previous Quarter

$
0
0

Hello riccarddo,

Please use the following:

WITH StarDate (firstday) as
(
SELECT d - DAYOFYEAR(d) DAYS + ((QUARTER(d) - 1) * 3) MONTHS - 3 MONTHS + 1 DAY
FROM (VALUES DATE('2017-04-21')) as D(d)
)

SELECT * FROM StarDate

This works in DB2 LUW.

Regards
Ondrej


Viewing all articles
Browse latest Browse all 389

Trending Articles