这是我的查询行,我收到错误信息8114,级别16,状态5.我有完全按照我需要的总和和舍入 - 只是无法使+'%'部分工作:< / p>
SUM(CAST(ROUND(ENROLLMENT,1) AS DECIMAL (10,2)))/SUM(CAST(ROUND(CAPACITY,1) AS DECIMAL (10,2))) *100 + '%' AS 'fill rate %'
任何帮助将不胜感激!
答案 0 :(得分:1)
将您的小数转换为varchar
findPreference(getString(R.string.notification_key)).setOnPreferenceChangeListener(this);
@Override
public boolean onPreferenceChange(Preference preference, Object newVal) {
if (preference.getKey().equals(getString(R.string.notification_key))) {
Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), Uri.parse(newVal.toString()));
String name = ringtone.getTitle(getActivity());
preference.setSummary(name);
}
return false;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode,resultCode,data);
}
或者根本不添加%。列标题已经说明了它是一个%字段...
cast(SUM(CAST(ROUND(ENROLLMENT,1) AS DECIMAL (10,2)))/SUM(CAST(ROUND(CAPACITY,1) AS DECIMAL (10,2))) *100 as varchar(100)) + '%' AS 'fill rate %'
或者,如果您要显示此内容,则显示屏会在显示小数值的字段右侧添加“&#39;%&#39;”