I was given some SQL to run against our db and it is throwing a syntax error. I have looked through and cannot find the missing expression. Can anyone please assist? It says line 6 column 42, which correlates to the first "ts".
Thanks, Andrew
SELECT "IWRKGRPQUEUESTATS"."CNAME", "IWRKGRPQUEUESTATS"."CHKEY3", "IWRKGRPQUEUESTATS"."NENTEREDACD", "IWRKGRPQUEUESTATS"."NINTERNTOEXTERNCALLS", "IWRKGRPQUEUESTATS"."NANSWEREDACD", "IWRKGRPQUEUESTATS"."TANSWEREDACD", "IWRKGRPQUEUESTATS"."TTALKACD", "IWRKGRPQUEUESTATS"."CHKEY4", "IWRKGRPQUEUESTATS"."DINTERVALSTART", "IWRKGRPQUEUESTATS"."NHOLDACD", "IWRKGRPQUEUESTATS"."THOLDACD", "IWRKGRPQUEUESTATS"."NABANDONEDACD", "IWRKGRPQUEUESTATS"."NABANDONACDSVCLVL1", "IWRKGRPQUEUESTATS"."NABANDONACDSVCLVL2", "IWRKGRPQUEUESTATS"."NABANDONACDSVCLVL3", "IWRKGRPQUEUESTATS"."NABANDONACDSVCLVL4"
FROM "ADMIN"."IWRKGRPQUEUESTATS" "IWRKGRPQUEUESTATS"
WHERE "IWRKGRPQUEUESTATS"."CHKEY4"=N'*' AND "IWRKGRPQUEUESTATS"."CHKEY3"<>N'*'
AND ("IWRKGRPQUEUESTATS"."CNAME">=N'ATEAM'
AND "IWRKGRPQUEUESTATS"."CNAME"<=N'STORES')
AND ("IWRKGRPQUEUESTATS"."DINTERVALSTART">={ts '2016-08-17 00:00:00'}
AND "IWRKGRPQUEUESTATS"."DINTERVALSTART"<{ts '2016-08-17 23:59:59'})
ORDER BY "IWRKGRPQUEUESTATS"."CNAME";
{ts ...}.WHERE "IWRKGRPQUEUESTATS"."CHKEY4"=N'*'