I want to perform a query, retrieving all entries linked to a specific
item, in a many-to-many relationship.

I have three tables (for this demonstration anyway):
- categories (_id, name)
- items (_id, name)
- categories_items (_id, category_id, item_id)

I know that, in order to query for all categories belonging to a
specific item, I can use the following query:

SELECT a.*
FROM categories AS a, items AS b, categories_items AS c
WHERE b._id={rowId} AND c.item_id=b._id AND c.category_id=a._id

Where {rowId} obviously represents the ID of the item to search for. I
don't know if this query is the best way to do it, but I know that I
don't need a JOIN, since I only need the entries from one table.

Anyway, I know how to query this, but I'm curious if there's a way to
do this with SQLiteQueryBuilder? I've looked at the reference, and it
seems it would be easy enough to specify the tables, but the columns
are needed as an array of String objects. Would it accept it, if I
used "a.*" as a column specifier?

Thank you. :)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to