select * from 设备基本表 where 所属单位 = '金佳矿' and( 设备状态 <> '在用' and cast(设备余值 as float)/cast(设备原值 as float)<=0.3 or datediff(month,(select replace(replace(replace(投入年月,'年','-'),'月','-'),'日','')),getdate())>=cast(折旧年限 as int)*12)
备忘123
本文介绍了一种使用SQL查询特定条件下闲置设备的方法。通过复杂的条件筛选,如设备状态不在使用中且剩余价值低于原价30%或使用时间超过折旧年限等标准,实现了对指定单位(例如金佳矿)内符合条件的设备进行精准查询。

被折叠的 条评论
为什么被折叠?



