select CreateTime, DebugSN.OrderID, case Mode when '0' then 'Online' else 'Offlien' end as 'Mode', count(1) as 'TotalCount', count(case TestResult when '1' then 'pass' end) as 'PassCount', -- Sqlite整数相除得整数,所以分子必须乘于1.0才能强制得到小数; ROUND((count(case TestResult when '1' then 'pass' end)*100.0/count(1)),1) as 'PassRate', -- roung取精度; avg(ElapsedTime) as 'AvgElapsed', sum(ElapsedTime) as 'TotalElapsed', DebugOrders.DEValue from DebugSN INNER JOIN DebugOrders ON DebugSN.OrderID = DebugOrders.OrderID WHERE CreateTime >= '2022-03-04 08:38:52' and CreateTime <='2022-05-08 09:38:52' GROUP BY DebugSN.OrderID;