how to convert query related to calculate work hours in MySQL to MS Access I want to calculate work hours in each day using MS Access.I have query for same thing in MySQL but this thing is not working in MS Access using pdo php.

query in MySql

    SELECT MachineNo, Empcardno, Date, SEC_TO_TIME(SUM(tsecs)) AS total_time
FROM (
  SELECT CASE WHEN MachineNo = @mn AND Empcardno = @en AND `Date` = @dt
              THEN @rn := @rn + 1
              ELSE @rn := 1
         END AS rn,
         @mn := MachineNo AS MachineNo, @en := Empcardno AS Empcardno, 
         @dt := `Date` AS `Date`,
         CASE WHEN @rn % 2 = 1 THEN -TIME_TO_SEC(`Time`)
              ELSE TIME_TO_SEC(`Time`)
         END AS tsecs
  FROM timesheet
  CROSS JOIN (SELECT @mn := 0, @en := 0, @dt := '', @rn := 0) init
  ORDER BY Date, Time
) t
GROUP BY MachineNo, Empcardno, Date


how to convert this query to make compatible with ms access pdo connection using php 

table structure and data in ms-access

https://i.stack.imgur.com/YaCPp.png
SELECT MachineNo, Empcardno, [Date], 
       FORMAT(SUM(IIF(rn MOD 2 = 0, -TimeValue([Time]), TimeValue([Time]))),'hh:nn:ss') AS total_time
FROM (
  SELECT t1.MachineNo, t1.Empcardno, t1.Date, t1.Time, COUNT(t2.MachineNo) AS rn
  FROM timesheet t1
  LEFT JOIN timesheet t2 ON t2.MachineNo = t1.MachineNo 
                        AND t2.Empcardno = t1.Empcardno
                        AND t2.Date = t1.Date
                        AND TimeValue(t2.Time) &lt; TimeValue(t1.Time)
  GROUP BY t1.MachineNo, t1.Empcardno, t1.Date, t1.Time
)  AS t
GROUP BY MachineNo, Empcardno, Date


for complete detail please see the link 
https://stackoverflow.com/questions/62297919/how-to-convert-query-related-to-calculate-work-hours-in-mysql-to-ms-access/62317847#comment110225804_62317847