0
我需要从月的第一天到第15天(包括)和从第16天到月底(包括最后一天)提取和分组时间戳信息如何从postgresql中的时间戳中提取句点
我每周只做这个。下面是代码
SELECT
extract(week from dttrnreqdate) AS period,
SUM(bonusesCharged - bonusesCharged_rev) AS bonusesChargedForPeriod,
SUM(bonusesWithdrawn - bonusesWithdrawn_rev) AS bonusesWithdrawnForPeriod
FROM
ls.vstatement AS v
WHERE
v.dttrnreqdate >= to_timestamp('2014-12-01 00:00:00', 'yyyy-mm-dd 00:00:00') AND
v.dttrnreqdate < to_timestamp('2015-01-07 00:00:00', 'yyyy-mm-dd 00:00:00')
GROUP BY
extract(week from dttrnreqdate)
ORDER BY
extract(week from dttrnreqdate)
ASC
其中 dttrnreqdate
是timestamp
bonusesCharged, bonusesCharged_rev, bonusesWithdrawn, bonusesWithdrawn_rev
- int
那么如何提取信息1-15和时间戳字段的16-30/31