我为Access DB编写了这个查询。
queryText = "SELECT Technicians.ID, firstName, lastName, Technicians.[Zone],
COUNT(technicianAssignedId) AS JobsDone,
MAX(Faults.timeCompleted) AS LastJobTime,
MIN(Technicians.[Zone] - & faultZone &) AS Distance ' MIN has no use
FROM Technicians LEFT OUTER JOIN Faults ON
Technicians.ID = Faults.technicianAssignedID
WHERE Specialization = '" & specialization & "'
`AND Availability = 'available'
GROUP BY Technicians.ID, firstName, lastName, Availability,` Technicians.[Zone], Specialization
ORDER BY 7 DESC"
我有这个获得绝对值
SELECT CASE
WHEN value < 0 THEN value * -1
ELSE number *1 END
AS VALUE
FROM DB;
现在使用Distance别名的列可能会以负数表结尾,我需要使用(* -1)作为正数,但我无法弄清楚如何将它们组合在一起。
感谢您的帮助
答案 0 :(得分:5)
答案 1 :(得分:3)
为什么不能只使用绝对函数ABS
?
答案 2 :(得分:1)
ABS()适用于所有SQL版本