SELECT * FROM (
SELECT
ORG_ROADMARK,
COUNT(DISTINCT EQUIP_INITIAL||EQUIP_NUM||move_dtm) AS Billing_Count
FROM CMD_BILLING_INFO
WHERE move_dtm BETWEEN' 01-FEB-12' AND '29-FEB-12'
AND (
(MOVE_TYPE_CD ='ICR' AND EQUIP_STATUS_CD IN ('L','W'))
OR
( MOVE_TYPE_CD ='RLO' AND EQUIP_STATUS_CD ='L' )
OR
( MOVE_TYPE_CD ='RMT' AND EQUIP_STATUS_CD ='W' )
) GROUPBY ORG_ROADMARK
) ORDERBY ORG_ROADMARK
I am getting missing right parenthesis error for the above sql. Using this sql I was able to get the result for the month period and tried to modify this to get result for last 24 months month by month any suggestions please.