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