I am developing a restaurant menu application on Android. My application has one database table that has the following columns:
- id (primary key)
- category
- item name
The category column shows the product category, such as veg, non veg, snacks, etc. It has duplicate values, and I want to select only individual values from this column. I tried the following, but it does not work if someone can provide a solution:
String query = "SELECT DISTINCT category FROM todo"; Cursor cursor = database.rawQuery(query,null); if (cursor != null) { cursor.moveToFirst(); } return cursor;
sagar source share