Return one instance of each different SQLite column
The query I am doing is:
Cursor cursor = managedQuery(Formula.CONTENT_URI, new String[] { Formula._ID, Formula.CATAGORY }, null, null, null);
The problem is that it returns:
Algebra
Algebra
Algebra
...
Geometry
Geometry
...
How can I query this so that it return just ONE of each different column:
Algebra
Geometry
UPDATE:
The query I am running is:SELECT * FROM for开发者_JAVA百科mula
try
SELECT DISTINCT * from formula;
But it is better practice to list out the column names, instead of using the * just in case anything changes.
so it'll look like
SELECT DISTINCT column_name from formula;
But the key really is the DISTINCT keyword.
精彩评论