PostgreSQL實(shí)現(xiàn)按年、月、日、周、時(shí)、分、秒的分組統(tǒng)計(jì)
時(shí)間:2024-02-05 11:03作者:下載吧人氣:21
按年查詢
select to_char(date::DATE, ‘YYYY’) as year,sum(shares) as shares, sum(visits) as visits
from database_table
where date >= ‘2019-01-01’ and date <= ‘2020-01-01’ group by year order by year
標(biāo)簽MySQL,技術(shù)文檔,數(shù)據(jù)庫(kù),PostgreSQL
網(wǎng)友評(píng)論