I have 3 tables: A, B, C
Table A:
a_id text
---------- ----------
1 Hi
2 Hello
3 Foo
Table B:
a_id c_id
---------- ----------
1 1
1 2
2 2
3 2
Table C:
c_id name
---------- ----------
1 Name1
2 Name2
I want this result:
a_id text mvalue
---------- ---------- ----------
1 Hi Name1,Name2
2 Hello Name2
3 Foo Name2
To do this, i'm using this query :
SELECT A.a_id, A.text, GROUP_CONCAT(C.name) AS mvalue
FROM A
INNER JOIN B ON B.a_id = A.a_id
INNER JOIN C ON C.c_id = B.c_id
GROUP BY A.a_id
ORDER BY A.a_id DESC
When I use it on MySQL it works as expected but when I run this query on Android with SQLite, i'm only getting result attached to C.c_id = 1 I have this result instead:
a_id text mvalue
---------- ---------- ----------
1 Hi Name1,Name2
Is there a problem with my query? Do I miss something?
Thanks
Aucun commentaire:
Enregistrer un commentaire