我试图在 case 语句中获取一条记录,我想将 seelect 语句放在哪里(1)
CASE WHEN CAST(VehicleCC AS MONEY) BETWEEN -1 AND 50 THEN '33.94'
WHEN CAST(VehicleCC AS MONEY) BETWEEN 51 AND 125 THEN '39.65'
WHEN CAST(VehicleCC AS MONEY) BETWEEN 126 AND 500 THEN '55.90'
WHEN CAST(VehicleCC AS MONEY) BETWEEN 501 AND 650 THEN '67.31'
WHEN CAST(VehicleCC AS MONEY) BETWEEN 651 AND 1000 THEN '78.65'
WHEN CAST(VehicleCC AS MONEY ) > 1001 THEN '79.85'
else
(SELECT TOP(1) cast (VehicleCC as varchar (50)) FROM HIRE_INSTRUCTION HIRP
INNER JOIN VEHICLE VEH ON HIRP.FKFleetVehicleID=VEH.vehicleid
WHERE HIRP.FKBLDRefID=cl.FKBLDRefID AND HIRP.Deleted=0 AND VEH.Deleted=0
ORDER BY veh.VehicleCC DESC) END AS [Hire Rate Charged Per Day],