Android的SQLite数据库删除重复查询 [英] Android SQLite database remove duplicates from query
本文介绍了Android的SQLite数据库删除重复查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的SQLite。我使用此查询,以提取一列所有行针对特定用户:
I'm new to SQLite. I'm using this query in order to extract all rows from a column for a specific user:
Cursor c = db.query(true, TABLE, COLUMN, USER + "= '" + user + "'", null, null, null, null, null);
这是表的例子:
|group-----ID|
|------------|
|one-------me|
|one------you|
|two-------me|
|one-------me|
所以查询用户我提取物一,二,一。我如何才能获得一个值只是一个时间筛选结果?像一,二
So the query for user "me" extracts "one, two, one". How can I filter the result in order to obtain a value just one time? Like "one, two"
感谢
推荐答案
使用本集团通过与相应的列名的参数:
Use the Group By parameter with the appropriate column name:
Cursor c = db.query(true, TABLE, COLUMN, USER + "= '" + user + "'", null,
"group", null, null, null);
由于在该方法中九个参数和三个几乎相同的方法...
Since there are nine parameters in this method and three nearly identical methods...
public Cursor query(boolean distinct,
String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy, /* this one */
String having,
String orderBy,
String limit)
这篇关于Android的SQLite数据库删除重复查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文