select distinct value in android sqlite

But you MUST remember to send argument in GROUPBY (NOT NULL send).

You must give column name for distinct.

Example:

Cursor cursor = db.query(true, YOUR_TABLE_NAME, new String[] { COLUMN_NAME_1 ,COLUMN_NAME_2, COLUMN_NAME_3 }, null, null, COLUMN_NAME_2, null, null, null);

true – distinct TRUE

COLUMN_NAME_2 – name column what you have be DISTINCT.

That’s works for me fine.

Leave a Comment