I am troubling over this error as I am not sure what the cause might be. Any help would be greatly appreciated.
select sasnref.trx_date, count(OCS.SERVED_MOBILE_NUMBER)
from
(
select sasn.trx_date, sasn.SERVED_MOBILE_NUMBER
from
(
SELECT trx_date, SERVED_MOBILE_NUMBER, APN, SUM( VOLUME_UPLINK) uplink,SUM(VOLUME_DOWNLINK) downlink
FROM EDWIN_V.SASN_FACT_UDR_DAILY_201305
where CAST((trx_date (format 'yyyymmdd')) as char(8)) = '20130501'
group by trx_date , SERVED_MOBILE_NUMBER, APN
) sasn inner join
(
SELECT execution_time, count(*) num_trx, APPS_ID, SERVED_MOBILE_NUMBER, REQ_REGION, REQ_HOME, CHARGING_ID
FROM EDWIN_V.REFLEX_FACT_201305
where apps_id='fsd' and STATUS_FLOW_REQUEST='OK00' and wording_add not like '%GIFT%' and execution_status = 'S' and charging_id='flash2k'
and cast( EXECUTION_TIME as date format 'yyyymmdd') = '20130501'
group by APPS_ID, SERVED_MOBILE_NUMBER, REQ_REGION, REQ_HOME, CHARGING_ID, execution_time
) reflex
on sasn.SERVED_MOBILE_NUMBER = reflex.SERVED_MOBILE_NUMBER and CAST((reflex.execution_time (format 'yyyymmdd')) as char(8)) = CAST((sasn.trx_date (format 'yyyymmdd')) as char(8))
where (uplink + downlink) > 5242880
) sasnref EXCEPTION JOIN
(
SELECT CAST((trx_date (format 'yyyymmdd')) as char(8)) trx_date, SERVED_MOBILE_NUMBER
FROM EDWIN_V.FACT_OCS_201305
where CAST((trx_date (format 'yyyymmdd')) as char(8)) = '20130501'
group by CAST((trx_date (format 'yyyymmdd')) as char(8)), SERVED_MOBILE_NUMBER
) OCS
on sasnref.trx_date = OCS.trx_date and sasnref.SERVED_MOBILE_NUMBER = OCS.SERVED_MOBILE_NUMBER
group by sasnref.trx_dat
result: Select Failed 3706: Syntax error: expected something between the word 'sasnref' and the word 'EXCEPTION'