Dealing w/ Sqlite Join results in a cursor

Posted by Bill on Stack Overflow See other posts from Stack Overflow or by Bill
Published on 2010-06-02T15:35:48Z Indexed on 2010/06/02 17:14 UTC
Read the original article Hit count: 295

Filed under:
|
|
|
|

I have a one-many relationship in my local Sqlite db. Pretty basic stuff. When I do my left outer join I get back results that look like this:

the resulting cursor has multiple rows that look like this:

A1.id | A1.column1 | A1.column2 | B1.a_id_fk | B1.column1 | B1.column2 

A1.id | A1.column1 | A1.column2 | B2.a_id_fk | B2.column1 | B2.column2 

and so on...

Is there a standard practice or method of dealing with results like this ? Clearly there is only A1, but it has many B-n relationships. I am coming close to using multiple queries instead of the "relational db way". Hopefully I am just not aware of the better way to do things.

I intend to expose this query via a content provider and I would hate for all of the consumers to have to write the same aggregation logic.

© Stack Overflow or respective owner

Related posts about android

Related posts about sqlite