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