我有一个包含两列的表,如
VENDOR_NAME DIRECTORY_NAME
DL_101Records .ssh
DL_101Records ADHOC
DL_101Records ARCHIVED
DL_101Records INBOUND
DL_101Records OUTBOUND
DL_101Records PROCESSED
DL_101Records pub
DL_101Records TAKEDOW
<磷>氮
是否有一种简单的方法可以将其转换为单个字符串,如
VENDOR_NAME DIRECTORY_NAME
DL_101Records .SSH ,ADHOC ,ARCHIVED ,INBOUND ,OUTBOUND ,PROCESSED ,PUB ,TAKEDOWN
答案 0 :(得分:1)
试试这个,
DECLARE @TEMP VARCHAR(MAX)='';
SELECT @TEMP=@TEMP+DIRECTORY_NAME+', ' FROM YOURTABLE
SELECT VENDOR_NAME,@TEMP FROM YOURTABLE
GROUP BY VENDOR_NAME
答案 1 :(得分:0)
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
final GetAdvReqPackagesListResponse.PackageList packageList1 = packageList.get(position);
if (packageList.get(position).getSelection_flag().equals("1")) {
subHolder.chkBoxSelectPackage.setChecked(true);
} else {
subHolder.chkBoxSelectPackage.setChecked(false);
}
holder.chkBoxSelectPackage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked == true) {
//holder.chkBoxSelectPackage.setChecked(true);
packageList.get(position).setSelection_flag("1");
holder.textPackageCode.setTextAppearance(context, R.style.font_color_green_size_13sp);
holder.textPackageDesc.setTextAppearance(context, R.style.font_color_green_size_13sp);
holder.textLaborTU.setTextAppearance(context, R.style.font_color_green_size_13sp);
holder.textLaborAmt.setTextAppearance(context, R.style.font_color_green_size_13sp);
holder.textPartsCount.setTextAppearance(context, R.style.font_color_green_size_13sp);
holder.textPartsAmt.setTextAppearance(context, R.style.font_color_green_size_13sp);
} else if (isChecked == false) {
// holder.chkBoxSelectPackage.setChecked(false);
packageList.get(position).setSelection_flag("0");
holder.textPackageCode.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
holder.textPackageDesc.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
holder.textLaborTU.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
holder.textLaborAmt.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
holder.textPartsCount.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
holder.textPartsAmt.setTextAppearance(context, R.style.font_small_color_black_size_13sp);
}
notifyDataSetChanged();
}