Hi,
The query which i have written is not running in teradata, I dont know why, syntactically it is correct but not running Giving an error message.
Do you have any alternative solution for this query?
Query:
Select
count(*)
from
mediafact_stg m
Where
m.action_id in(1004,1005)
AND not exists(select 'x'
from
Media_event me,
media_event_x_source mexs,
Subscriber_service ss1,
subscriber_service_activity ssa
Where
mexs.sourcesessionid=m.session_id
And mexs.datasourceid=163
And mexs.mediaeventid=me.mediaeventid
And me.subscriberserviceid =
Case
When m.member_partner_plan_id in(select ssxs.subscriberserviceid from subscriber_service_x_source ssxs)
then m.member_partner_plan_id
WHEN ss1.subscriberserviceid=ssa.subscriberserviceid
and
m.t_timestamp >=(cast((cast(cast(ssa.startdt as date)as varchar(20))||' '||cast(cast(ssa.starttime as time(6))as varchar(20))) as timestamp)
) and
m.t_timestamp<=(CAST((cast(cast(ssa.enddt AS DATE )as varchar(20))||' '||cast(CAST(ssa.endtime AS TIME(6)) as varchar(20)))as timestamp)
) and ss1.partyid=m.user_id
then ss1.subscriberserviceid
END)
Thanks
Regards
Narendra
The query which i have written is not running in teradata, I dont know why, syntactically it is correct but not running Giving an error message.
Do you have any alternative solution for this query?
Query:
Select
count(*)
from
mediafact_stg m
Where
m.action_id in(1004,1005)
AND not exists(select 'x'
from
Media_event me,
media_event_x_source mexs,
Subscriber_service ss1,
subscriber_service_activity ssa
Where
mexs.sourcesessionid=m.session_id
And mexs.datasourceid=163
And mexs.mediaeventid=me.mediaeventid
And me.subscriberserviceid =
Case
When m.member_partner_plan_id in(select ssxs.subscriberserviceid from subscriber_service_x_source ssxs)
then m.member_partner_plan_id
WHEN ss1.subscriberserviceid=ssa.subscriberserviceid
and
m.t_timestamp >=(cast((cast(cast(ssa.startdt as date)as varchar(20))||' '||cast(cast(ssa.starttime as time(6))as varchar(20))) as timestamp)
) and
m.t_timestamp<=(CAST((cast(cast(ssa.enddt AS DATE )as varchar(20))||' '||cast(CAST(ssa.endtime AS TIME(6)) as varchar(20)))as timestamp)
) and ss1.partyid=m.user_id
then ss1.subscriberserviceid
END)
Thanks
Regards
Narendra