Good evening ( for me ), I'm Emanuele a young android developer. 
I want to share with you my problem because I'm not finding a good solution.

I've 3 tables (in reality 5)

posts
categories
posts_categories

to create the many-to-many relation between posts and categories

I've created a ListFragment to show all my posts with their categories.

So I've created this query ( I don't write all the code [image: :)] )

SELECT posts._id, posts.post_title, categories.category_name FROM posts LEFT 
OUTER JOIN posts_categories ON posts_categories.post_id=posts.post_id LEFT 
OUTER JOIN categories ON 
posts_categories.category_id=categories.category_id;

So if I have 2 post with 2 category each that query will return 4 records. 
Am I wrong?
So in my Cursor I have 4 record but what I really need is to collect datas 
from the cursor and display only what I really need.

In this case I cannot use a CursorAdapter to display my data because it will 
insert 4 item in the ListFragment.

And I don't want to load only post and than for each post load categories 
because if I have 100 posts I will do 1 query to select all posts and 100 
query to select categories.


What can I do? I need an expert advice! Which is the best way to handle this 
situation?
Have you ever faced this problem?

Thank you very much. Emanuele Ricci.

-- 
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