I have the following query which runs fine in MSSQL Management Studio, but will not even let me accept the query in Ignition.
(CASE WHEN (DatePart(mi,max(t_stamp) - min(t_stamp))) <= 0 THEN 0 ELSE (max(Good_Bags)-min(Good_Bags)) / cast((DatePart(mi,max(t_stamp) - min(t_stamp)))as decimal(4,1)) END AS DECIMAL(4,1)),0) as "BPM"
WHERE EquipID like '%MET_02' and
t_stamp > DateAdd(mi,-5,GetDate()) and
GOOD_BAGS > 0
Any Ideas? I will need to replace the hard coded EquipID with a Tag, but I can handle that if the query will run otherwise.