任何人都请指出为什么我会收到此错误?
SELECT imax, iResult
FROM(
SELECT
top 20000 CAST(Pro_PCT AS INT),
CAST(REPLACE(Max_Off,'%','') AS INT) AS 'iMax',
iif(CAST(Pro_PCT AS INT)> CAST(
REPLACE(Max_Off,'%','') AS INT),'Yes','No') AS 'iResult'
FROM
dbo.FO_Entry) AS TableA
WHERE iResult = 'yes'
答案 0 :(得分:2)
我会改用case
表达式:
SELECT imax, iResult
FROM( SELECT TOP (20000) CAST(Pro_PCT AS INT) AS Pro_PCT, CAST(REPLACE(Max_Off,'%','') AS INT) AS iMax,
(CASE WHEN CAST(Pro_PCT AS INT) > CAST(REPLACE(Max_Off,'%','') AS INT)
THEN 'Yes' ELSE 'No'
END) AS iResult
FROM dbo.FO_Entry
) AS TableA
WHERE iResult = 'yes';
答案 1 :(得分:1)
您缺少列名CAST(Pro_PCT AS INT),这就是该错误的原因:
const md = {
"37aa0778-c148-4c04-b239-18885d46a8b0": 0,
"869a7967-ffb3-4a20-b402-ad6d514472de": 0,
"92c0f155-ce82-4b50-821f-439428c517a3": 0,
"aa9eb0f2-35af-469a-8893-fc777b444bed": 0,
"967d63ea-492c-4475-8b08-911be2d0bf22": 0,
"47ec8d60-1fa2-4bf5-abc8-34df6bd53079": 0,
"92c0f155-ce82-4b50-821f-439428c517a3": 0
};
for (const {created_at, created_by_id} of DailyLogs) {
if (created_at >= this.state.startMonth && created_at <= this.state.finishMonth && md.hasOwnProperty(created_by_id)) {
md[created_by_id]++;
}
}