我想以更好和更有效的方式编写以下查询有什么帮助吗?
SELECT a.assetnum as Asset,
a.assettag as Asset_Tag,
a.manufacturer as Manufacturer,
a.serialnum as Serial,
a.description as Description,
(
SELECT CASE a.isrunning
WHEN 1
THEN 'Operational'
WHEN 0
THEN 'Down'
END
) AS Condition ,
l.kbs_loctag as Location,
(
SELECT TOP 1 wo.wonum
FROM workorder wo
WHERE wo.assetnum = a.assetnum
and wo.worktype = 'UN'
ORDER BY wo.reportdate DESC
) AS Last_Workorder,
(
SELECT wo.statusdate
FROM workorder wo
WHERE wo.wonum IN
(
SELECT top 1 wo.wonum
FROM workorder wo
WHERE wo.assetnum = a.assetnum
AND wo.worktype = 'UN'
ORDER BY wo.reportdate DESC
)
) AS Last_Status_Date,
(
SELECT top 1 lt.memo
FROM labtrans lt
WHERE lt.assetnum = a.assetnum
AND lt.transtype = 'REPAIR'
ORDER BY lt.transdate DESC
) AS Action
FROM asset a
LEFT OUTER JOIN locations l
ON a.location = l.location
WHERE (
a.description like '%WASH%'
or a.description LIKE '%DRYER%'
)
ORDER BY l.location,
a.description