Reputation: 27
I have the following query
SELECT MIN(SUBSTR(START_TIME,12,15)), MAX(SUBSTR(END_TIME,12,15))
FROM JOBS_HISTORY2
WHERE ORDER_DATE = 20190904
I am currently running this and changing the order_date manually by incrementing it by one and copying over the result. Is there a way where its possible to modify the query so it runs it for all remaining days? such as 20190905, 20190906 etc. I tried the following; I thought about putting all the dates in a list and using 'IN' but are there better ways that are more effective?
This is oracle sql developer
Upvotes: 1
Views: 86
Reputation: 1269443
Do you just want GROUP BY
?
SELECT ORDER_DATE, MIN(SUBSTR(START_TIME,12,15)), MAX(SUBSTR(END_TIME,12,15))
FROM JOBS_HISTORY2
WHERE ORDER_DATE >= 20190904
GROUP BY ORDER_DATE
ORDER BY ORDER_DATE;
Upvotes: 2