Friday, June 10, 2011

Re: [android-developers] Re: SQLite complex query and handling results

On Fri, Jun 10, 2011 at 5:24 PM, Emanuele Ricci <stermi@gmail.com> wrote:
> Ok I solved it:
>
> SELECT posts.post_id, posts.post_title,
> GROUP_CONCAT(categories.category_name) AS categories_name,
> GROUP_CONCAT(categories.category_id) AS categories_id,
> GROUP_CONCAT(tags.tag_id) AS tags_id, GROUP_CONCAT(tags.tag_name) AS
> tags_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 LEFT OUTER JOIN
> posts_tags ON posts_tags.post_id=posts.post_id LEFT OUTER JOIN tags ON
> posts_tags.tag_id=tags.tag_id GROUP BY posts.post_id;
>
> Thank you very much for the hint of GROUP_CONCAT!!!
>
> Anyway I always think that Android need something to bind Object to DB like
> in web frameworks :)
>

Of course, such a thing exists :) But if you don't understand how SQL
works, you still might not get good results.

http://ormlite.com/sqlite_java_android_orm.shtml

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment