1
但是,我建立了一個查詢(見下文),而不是返回「大於20或30」,我希望我的查詢實際顯示計數(例如31,35,50等)。我似乎無法弄清楚如何去做。謝謝您的幫助。字符長度SQL Server 2005
select
cc_units_of_measure.description as UOM_Description,
case when LEN(cc_units_of_measure.description) < 20 then 'OK'
else 'Greater than 20'
end as Results_UOM_description,
cc_units_of_measure.company_abbreviation as UOM_Company_Abbreviation,
case when LEN(cc_units_of_measure.company_abbreviation) < 20 then 'OK'
else 'Greater than 20'
end as Results_UOM_company_abbreviation,
cc_frequencies.description as Freq_Description,
case when LEN(cc_frequencies.description) < 30 then 'OK'
else 'Greater than 30'
end as Results_Frequency_description
from cc_units_of_measure, cc_frequencies
通過計數你的意思是字符的長度? – Vasanth
嘗試從'select Sum(Len(cc_units_of_measure.description)<20 then 1 else 0 end)的情況下工作爲[UOM_LT20],...'。 – HABO
它是長度還是數字?另外,你的「else」應該是「等於或大於xx」 – Elmer