BradCustom
IS-IT--Management
I'm working with Access 2016 and SQL 2012. I'm trying to convert the following query from Access to SQL but I keep getting errors. I've listed the statement and the errors below. Any help would be very much appreciated.
Errors
Thanks for your help!!
Code:
SELECT dbo_Employee.Employee, dbo_Employee.Last_Name, dbo_Transaction_Data.Transaction_Start, dbo_Transaction_Data.Transaction_End, dbo_Transaction_Detail.Job, dbo_Transaction_Detail.Work_Center, dbo_Job_Operation.Operation_Service, (DateDiff(minute,dbo_Transaction_Data.Transaction_Start,dbo_Transaction_Data.Transaction_End)/60) AS Hrs Open, dbo_Employee.Status
FROM ((dbo_Transaction_Data INNER JOIN dbo_Employee ON dbo_Transaction_Data.Employee = dbo_Employee.Employee) INNER JOIN dbo_Transaction_Detail ON dbo_Transaction_Data.Transaction_Data = dbo_Transaction_Detail.Transaction_Data) LEFT JOIN dbo_Job_Operation ON (dbo_Transaction_Detail.Job = dbo_Job_Operation.Job) AND (dbo_Transaction_Detail.Work_Center = dbo_Job_Operation.Work_Center)
WHERE (((dbo_Transaction_Data.Transaction_Start) Between gedate()-2 And getdate()) AND (((DateDiff(minute,dbo_Transaction_Data.Transaction_Start,dbo_Transaction_Data.Transaction_End)/60))>11 Or ((DateDiff(minute,dbo_Transaction_Data.Transaction_Start,dbo_Transaction_Data.Transaction_End)/60)) Is Null) AND ((dbo_Employee.Status)='active'))
ORDER BY dbo_Transaction_Data.Transaction_Start DESC , dbo_Transaction_Data.Transaction_End;
Errors
Code:
Incorrect syntax near 'DateDiff"
Incorrect syntax near 'dbo_Transaction_Data'
Incorrect syntax near ','
Thanks for your help!!