Parsing of SQL Query Failed
Hi,
Using MS SQL I have this query that returns records in SSMS.
But it does not work when adding the query as a SQL local data source.
- SELECT
- qd.QUEUENAME AS 'Group',
- ti.FIRST_NAME AS 'Technician',
- count (wo.WORKORDERID) AS 'Inbound',
- dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (wo.createdtime/1000),'01-01-1970 00:00:00') as 'Date',
- count(case when (std.ispending='1') THEN 1 ELSE NULL END) 'Total Pending',
- count(case when (std.ispending='0') THEN 1 ELSE NULL END) 'Total Completed',
- count(case when (std.statusname='OnHold') THEN 1 ELSE NULL END) 'Onhold',
- count(case when (std.statusname='resolved') THEN 1 ELSE NULL END) 'Resolved',
- count(case when (wos.ISOVERDUE='1') THEN 1 ELSE NULL END) 'SLA violated',
- count(case when (wos.ISOVERDUE='0') THEN 1 ELSE NULL END) 'SLA not violated',
- count(case when (wos.IS_FR_OVERDUE='1') THEN 1 ELSE NULL END) 'Response SLA violated',
- count(case when (wos.IS_FR_OVERDUE='0') THEN 1 ELSE NULL END) 'Response SLA not violated',
- count(case when (wos.ISFCR='1') THEN 1 ELSE NULL END) 'FCR',
- count(case when (wos.REOPENED='1') THEN 1 ELSE NULL END) as 'Reopened',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.IS_FR_OVERDUE='1') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end 'Response % Violated',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.IS_FR_OVERDUE='0') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end 'Response % not Violated',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.ISOVERDUE='1') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end '% Violated',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.ISOVERDUE='0') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end '% not Violated',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.ISFCR='1') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end '% FCR',
- case when count(wo.workorderid) > 0 then cast(count(case when (wos.REOPENED='1') THEN 1 ELSE NULL END) *100 as float) / cast(count(wo.workorderid) as float) else null end '% Reopened'
- FROM WorkOrder wo
- LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
- LEFT JOIN SDUser td ON wos.OWNERID=td.USERID LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID
- LEFT JOIN StatusDefinition std on wos.statusid=std.statusid
- LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID
- WHERE (wo.ISPARENT='1') AND qd.QUEUENAME <> 'NULL' AND ti.FIRST_NAME <> 'NULL'
- --and wo.createdtime >= <from_lastmonth> and wo.createdtime <= <to_lastmonth>
- GROUP BY Qd.QUEUENAME, ti.FIRST_NAME, Wo.CREATEDTIME
- order by 1
Problem is in when I create a new data source then add the same query I get the error "Parsing of SQL Query Failed"
How can I get this to work?
New to ADSelfService Plus?