Oracle SQL query output from GMT to PST

239 views Asked by At

I am using below query for order trend on hourly basis in my application:

select TO_CHAR(A.CREATED_DATE,'dd/mm/yyyy hh24') || ':' || DECODE(TRUNC(to_number(to_char(A.CREATED_DATE,'HH'))),0,'00','00') "date", count(*) cnt
FROM Schema.Table1 A, Schema.Table2 B WHERE A.UIDPK=B.ORDER_UID
AND **a.LAST_MODIFIED_DATE >= to_date('10/16/2011 00:00:00','MM/DD/YYYY HH24:MI:SS')**
AND ***a.LAST_MODIFIED_DATE <= to_date('10/16/2011 23:59:00','MM/DD/YYYY HH24:MI:SS')***
and STATUS='XXXXX' AND SUB_STATUS='XXXXXX'
GROUP BY TO_CHAR(A.CREATED_DATE,'dd/mm/yyyy hh24') ,TRUNC(to_number(to_char(A.CREATED_DATE,'HH')))
ORDER BY TO_CHAR(A.CREATED_DATE,'dd/mm/yyyy hh24') ASC;

CREATED_DATE and LAST_MODIFIED_DATE are the columns to capture the time placing an order.

But I am not getting desired output and it gives the output in GMT as the database server is in GMT. Now I want to make the changes in the query and sorted as latest record comes first and the output should give me the data in PST timing.

0

There are 0 answers