Thursday, October 7, 2010

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

No comments:

Post a Comment