你可能有小時,分鐘,秒您的工具未顯示給您的SUBMITS
列;這樣,您認爲所有行具有相同的SUBMITS
值,但它們只有相同的日期,但時間不同。
如果是這樣,您只需將信息限制在一個日期,但不小時,分鐘和秒:
select count(req_id), trunc(SUBMITS)
from requests
where result='REJECT'
GROUP BY trunc(SUBMITS)
例如:
SQL> create table requests (submits date, result VARCHAR2(10), req_id NUMBER);
Table created.
SQL> insert into requests (req_id, submits, result) values (1, sysdate, 'REJECT');
1 row created.
SQL> insert into requests (req_id, submits, result) values (2, sysdate, 'REJECT');
1 row created.
SQL> insert into requests (req_id, submits, result) values (3, sysdate, 'REJECT');
1 row created.
SQL> select count(req_id), trunc(SUBMITS)
2 from requests
3 where result='REJECT'
4 GROUP BY trunc(SUBMITS);
COUNT(REQ_ID) TRUNC(SUB
------------- ---------
3 21-JUN-17
SQL> select count(req_id), SUBMITS
2 from requests
3 where result='REJECT'
4 GROUP BY SUBMITS;
COUNT(REQ_ID) SUBMITS
------------- ---------
1 21-JUN-17
1 21-JUN-17
1 21-JUN-17
也許你有小時,分鐘和秒你的約會?日期欄的類型是什麼? – Aleksej
這不應該發生。您的SUBMITS列是DATE還是CHAR/VARCHAR類型?如果是最新的,你可能會在其中看到不可見的字符 –
@ThomasG這是一個DATE類型。 – Rishabh