0

到目前为止,我有这个:\

SELECT Bike_Number, MaintFaultDetails, MaintactionTaken, MaintfaultDate, MaintActionDate,
       COUNT(*) 
FROM   MaintHistory
WHERE  (MaintfaultDate + 5) < MaintactionTaken 

SELECT Bike_Number, MaintFaultDetails, MaintactionTaken, MaintfaultDate, MaintActionDate,
       COUNT(*) 
FROM   MaintHistory

我会添加/编辑什么,以便计算使用时间超过 5 天的自行车的百分比

4

1 回答 1

0

试试看

 SELECT Bike_Number, MaintFaultDetails, MaintactionTaken, MaintfaultDate, MaintActionDate,
   Concat(count(Bike_Number)*100/COUNT(*).'%' ) as percent
 FROM   MaintHistory
 WHERE  DATE_ADD(MaintfaultDate, INTERVAL +5 DAY) < MaintactionTaken 
于 2013-02-23T15:54:13.047 回答