I have written a query to get the data received per day.
alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';
SELECT to_CHAR(created_date, 'yyyy/mm/dd'), status_code, COUNT(workflow_txn_id_log)
FROM workflow_txn_log
WHERE status_code = 'DOWNLOAD_ALL' AND created_date > '2021/08/11'
GROUP BY to_CHAR(created_date, 'yyyy/mm/dd'), status_code
ORDER BY to_CHAR(created_date, 'yyyy/mm/dd');
Now I want to get data with respect to every minute ordered in Ascending Order. I have tried to change date format but nothing is working. How do I do that?
It sounds like you want
trunc(created_date, 'mi')returns adatethat is truncated to the minute (i.e. the seconds are set to 0). That means that theorder bywill be using date comparison semantics to sort the dates rather than string comparison semantics which is what you want. Thewhereclause is comparingcreated_dateagainst adaterather than a string so that you're not doing implicit conversions.