我有这样的数据集:
Column1 Column2
1 A
1 B
1 C
1 D
2 E
2 F
2 G
3 H
3 I
Run Code Online (Sandbox Code Playgroud)
我想把它合并成这样的东西:
Column1 Column2
1 A, B, C
2 D, E, F, G
3 H, I
Run Code Online (Sandbox Code Playgroud)
是否有可能以某种方式在SQLite中执行此操作?我虽然是GROUP BY Column1,但我看不出如何将Column2数据合并到一个字符串中......
谢谢!
我要做的是为Title,Author和Cover这样的书显示一些数据,并在这些数据下面,让ListView包含一个可点击的章节列表.
我认为有一种方法是使用不同类型的单元格的ListView,其中第一个包含数据,其余的将是包含章节的简单单元格.ListView绑定到一个自定义CursorAdapter,它实现了newView(...)和bindView(...)方法,我不知道如何自定义以便根据单元格的位置返回不同类型的单元格.
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(cursor.getString(cursor.getColumnIndex(Constants.TITLE)));
..
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.bookcell, parent, false);
bindView(v, context, cursor);
return v;
}
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
谢谢!