월별통계 (2009-01 ~ 2010-01)
SELECT
COUNT(*) as count,
to_char(created_date, 'YYYY-MM') as created_date
FROM
table_name
WHERE
created_date>='2009-01-01' AND created_date<'2010-01-01'
GROUP BY
to_char(created_date, 'YYYY-MM');
일별통계 (2009-04-01 ~ 2009-04-30)
SELECT
COUNT(*) as count,
to_char(created_date, 'YYYY-MM-DD') as created_date
FROM
table_name
WHERE
created_date>='2009-04-01' AND created_date<'2009-05-01'
GROUP BY
to_char(created_date, 'YYYY-MM-DD');
'DataBase' 카테고리의 다른 글
Practical PostgreSQL - 문법상 특징 (0) | 2009.05.02 |
---|---|
[PostgreSQL] subquery를 LIKE 에 이용하기 (0) | 2009.04.18 |
[PostgreSQL] 문자열 나누기 (SPLIT_PART) (0) | 2009.04.18 |
[PostgreSQL] 날짜 구문 (0) | 2009.04.18 |
[MySQL] substring_index 사용법 (0) | 2009.04.18 |