我嘗試了很多時間來獲得正確的結果,但我總是失敗。我的代碼中找不到錯誤。我也想清楚create_time和close_time,以便日期不會重複。請幫助我。我的查詢沒有工作
這是示例輸出,我需要:
ID NAME CREATE_TIME CREATEDCOUNT CLOSE_TIME CLOSEDCOUNT
1 POS 01-JAN-14 1 01-JAN-14 1
2 EMAIL 02-JAN-14 10 02-JAN-14 10
THIS IS MY QUERY:
SELECT t.create_time, t.queue_id, q.name
FROM APP_ACCOUNT.OTRS_TICKET t
LEFT JOIN APP_ACOUNT.OTRS_QUEUE q
ON t.queue_id = q.id
WHERE t.CREATE_TIME BETWEEN SYSDATE -7 AND SYSDATE
GROUP BY trunc(t.create_time), t.queue_id, q.name
ORDER BY trunc(t.create_time), t_id, q.name;
表模式FOR APP_ACCOUNT.OTRS_TICKET(一些數據)
ID TITLE QUEUE_ID ... .... .... .... .... .... .... CREATE_TIME .... .... CLOSE_TIME ..... .....
39 Cannot access the Zimbra Email 11 5 1 3 2 hcph hcph POS-generic 15-OCT-13 5 \N 15-OCT-13 5 Office
40 Slow WIFI Connection 21 5 1 3 2 hcph hcph POS-generic 15-OCT-13 5 \N 15-OCT-13 5 Office
41 Change phone number in IDM 7 5 1 3 2 hcph hcph hcphuser 15-OCT-13 5 \N 15-OCT-13 5 Office
APP_ACCOUNT.OTRS_QUEUE的TABLE SCHEMA(某些數據)
ID NAME
58 Facilities and Procurement::Office Furniture Request
59 Facilities and Procurement::Supplies Request ��� Marketing & Sales
60 Facilities and Procurement::Supplies Request ��� Office Supplies
2 Raw
66 Procurement::Supplies Request - Office Supplies
您的預期產出是什麼? – San
@San我已經提到 – user3172075
以上爲什麼你使用'trunc' – zzlalani