I'm stuck on a query ... I go to the point.
Basically I have a table with 2 columns BREAD, DETAILS
.
I want to see everything in a ListView and not in a ExpandableListview, so I should change the query that I have created, I have done so, but I do not get the desired result, this:
EXAMPLE RECORDS IN THE TABLE:
BREAD - DETAILS
bread1 - flour
bread1 - yeast
bread1 - oil
bread1 - burnt
I want to see a result in ListView like this:
bread1
flour
yeast
oil
burnt
This the query:
String sql = "SELECT _id,BREAD, DETAILS FROM TABLE GROUP BY BREAD";
Cursor c = db.rawQuery(sql, null);
while (c.moveToNext()){
Dettaglio d = new Dettaglio();
d.id = c.getString(0);
d.bread = c.getString(1);
d.details = c.getString(2);
dettagli.add(d);
}
c.close();
db.close();