Tuesday 15 June 2010

android - sqlite join statement with 3 tables and filters -


Hello, I keep a little confused about this SQL query in SQL with SQLite

My Near 3 Simple Table Table Category

  | _id | Name | | 1 | Cat 1 | 2 | Cat 2 | 3 | Cat 3 | 4 | Kat 4   

Table List

  | _id | Name | | 1 | List 1 | 2 | List 2 3 | List 3 4 | List 4   

And I have another table that has an ID for the previous table

  | _id | Category | List | Name | 1 | 2 | 1 | Item 1 | 2 | 1 | 2 | Item 2 | 3 | 2 | 3 | Item 3 4 | 2 | 1 | Item4   

I have to leave the cat's table, so that always cat 1 (Count 10) cat 2 (count 2) cat 3 (count 3) cat 4 (count)

Post text "itemprop =" text ">

You can use a subquery :

  SELECT category.name In the form of a cat, join the category left as catcount from B.catcount (SELECT table3.category, calculation (*) as table 3 from WHEER table3 .list = 1 GROUP by table3.category) as a category on B. [_ Id] = ccategory;   

to give an output Hee:

  cat | catcount | cat 1 | null | | cat2 | 2 | | cat 3 | nulled | cat 4 | nulled |    

No comments:

Post a Comment