1SELECT value1, extract(YEAR FROM my_date)
2FROM my_table
3GROUP BY value1, extract(YEAR FROM my_date);
1Select count(1), country_of_sale, to_char(datefield, 'YYYY-MM') AS yyyymm
2from table
3where country_of_sale IN ('USA', 'EUROPE', 'ASIA')
4group by country_of_sale, to_char(datefield, 'YYYY-MM')
5order by to_char(datefield, 'YYYY-MM');
1/* DANIEL MOMBEYNI */
2SELECT M.YYYYMMDD,
3 M.HH24,
4 M.HALF_PART,
5 FROM (SELECT TO_CHAR(T.TIME_FIELD,
6 'yyyy/mm/dd') AS "YYYYMMDD",
7 TO_CHAR(T.TIMESTAMP, 'HH24') AS "HH24",
8 CASE
9 WHEN TO_CHAR(T.TIME_FIELD, 'MI') BETWEEN 0 AND 30 THEN
10 '0-30 min'
11 WHEN TO_CHAR(T.TIME_FIELD, 'MI') BETWEEN 31 AND 59 THEN
12 '31-59 min'
13 END AS "HALF_PART"
14 FROM TBL_NAME T) M
15 GROUP BY M.YYYYMMDD, M.HH24, M.HALF_PART
16 ORDER BY 1