Răsfoiți Sursa

添加Sqlite3日常测试Sql语句。

JeffWang 3 ani în urmă
părinte
comite
a92e4eda5a
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      DB/test.sql

+ 12 - 0
DB/test.sql

@@ -0,0 +1,12 @@
+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;