最初由 zuochc 发布
[B]这样可以解决你的问题?
SQL> select substr(to_char(d, 'yyyy-mm-dd hh24:mi:ss'), 1, 18) str,
2 to_char(d, 'yyyy-mm-dd hh24:mi:ss') d
3 from t;
STR D
------------------------------------ -------------------
2006-02-18 15:16:5 2006-02-18 15:16:52
2006-02-18 15:16:5 2006-02-18 15:16:53
2006-02-18 15:16:5 2006-02-18 15:16:54
2006-02-18 15:16:5 2006-02-18 15:16:54
2006-02-18 15:16:5 2006-02-18 15:16:54
2006-02-18 15:16:5 2006-02-18 15:16:54
2006-02-18 15:16:5 2006-02-18 15:16:54
2006-02-18 19:10:1 2006-02-18 19:10:10
2006-02-18 19:10:1 2006-02-18 19:10:10
2006-02-18 19:10:1 2006-02-18 19:10:10
2006-02-18 19:10:1 2006-02-18 19:10:11
2006-02-23 15:22:0 2006-02-23 15:22:04
2006-02-23 15:22:0 2006-02-23 15:22:05
2006-02-23 15:22:0 2006-02-23 15:22:05
已选择14行。
SQL> select substr(to_char(d, 'yyyy-mm-dd hh24:mi:ss'), 1, 18) str,
2 count(*) cnt
3 from t
4 group by substr(to_char(d, 'yyyy-mm-dd hh24:mi:ss'), 1, 18);
STR CNT
------------------------------------ ----------
2006-02-18 15:16:5 7
2006-02-18 19:10:1 4
2006-02-23 15:22:0 3
SQL> [/B]