mysql 时间向减写法
Posted 笨小孩做开发
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 时间向减写法相关的知识,希望对你有一定的参考价值。
select * from (
select c.OrderNumber ,
c.Name as equipmentName,
a.*,
d.Starttime, d.Endtime,
( select datediff(d.Starttime, d.Endtime)) as Lev ,
case ( select datediff(d.Starttime, d.Endtime))
when ( select datediff(d.Starttime, d.Endtime)) <=10 then ‘紧急维修‘
when 10<( select datediff(d.Starttime, d.Endtime))<=30 then ‘预计维修‘
else ‘无需维修‘ end as LevName
from cloud_componentlist a
left join
cloud_equipmentcomponen b on a.Id= b.component
left join cloud_equipment c on c.EquipmentId = b.EquipmentId
left join (select * from cloud_componentrepairrecord limit 0, 1 order by CreateDate desc ) d
on d.Cloud_componentId= a.Id where 1=1 order by Lev desc ) a limit 0,10;
以上是关于mysql 时间向减写法的主要内容,如果未能解决你的问题,请参考以下文章