Showing posts with label date and user. Show all posts
Showing posts with label date and user. Show all posts

Wednesday, 11 May 2011

Count of Orders cancelled by reason, date and user


Count of Orders cancelled by reason, date and user

Count of Orders Cancelled by Reason, Date and User
SELECT TO_CHAR(oolh.hist_creation_date,'YYYY-MM-DD') , usr.description , oolh.reason_code , count(distinct oolh.header_id) Orders FROM apps.oe_order_lines_history oolh , apps.fnd_user usr WHERE oolh.hist_creation_date > TRUNC(SYSDATE) -90 AND oolh.hist_type_code = 'CANCELLATION' AND oolh.last_updated_by = usr.user_id GROUP BY TO_CHAR(hist_creation_date,'YYYY-MM-DD') , usr.description , reason_code ORDER BY 1