我試圖顯示從AnnualBudget最小值,這裏是到目前爲止,我已經做了代碼:試圖找到最小值
SELECT WARD.HospitalCode,
HOSPITAL.HospitalCode Name,
WardNo,
AnnualBudget
FROM WARD,
HOSPITAL
WHERE (AnnualBudget) =
(SELECT AnnualBudget
FROM WARD
WHERE AnnualBudget =
(SELECT MIN(AnnualBudget)
FROM WARD
WHERE AnnualBudget >
(SELECT MIN(AnnualBudget)
FROM WARD
)
)
);
但而不是選擇最小值,它實際上選擇最大價值,任何人都可以幫忙嗎?
您的數字是否爲偶然的負值? – 2012-08-04 14:13:36
表中的值都是正值,我真的很困惑,爲什麼會發生這種情況。 – jeremy 2012-08-04 14:18:28
這是一個非常可怕的嵌套子查詢集。當然有更好的方法來重寫它們。 – Vic 2012-08-04 14:20:38