I have a SQL database, I've written a report in crystal reports that works great. I want to pull the same data into excel. If I use the same sql in MS Query I get errors on the date. Here is the code as it is used in Crystal, can someone help me make it MS Query compatible?
Code:
SELECT tps_user.tps_title AS Analyst, COUNT(im_incident_closure.im_guid) AS ClosedIncidents, tps_group.tps_title AS PrimaryGroup
FROM tps_user INNER JOIN
im_incident_closure ON tps_user.tps_guid = im_incident_closure.im_creation_user_guid INNER JOIN
tps_analyst ON tps_user.tps_guid = tps_analyst.tps_guid INNER JOIN
tps_group ON tps_user.tps_primary_group_guid = tps_group.tps_guid
WHERE (CAST(LEFT(DATEADD(hh, -8, im_incident_closure.Im_creation_date) , 19) AS smalldatetime) >= {?BeginDate}) AND (CAST(LEFT(DATEADD(hh, -8, im_incident_closure.Im_creation_date) , 19) AS smalldatetime) <= {?EndDate})
GROUP BY tps_user.tps_title, tps_group.tps_title