On 2/22/2012 1:05 PM, Danilo Cicerone wrote:
....two views. According to the following SQL statement(see below) I'm
going to create a table
'A' storing student's name, table 'B' storing courses and table D storing cards.
Furthermore, it creates two pivot tables A2B and A2D to refer courses and cards.
I'd like to query the DB to get that result:

1|John|Doe|Italian, Spanish|12345
2|Paul|Smith|English, Italian|12345, 13579

select A.*,
(select group_concat(b_course) from A2B join B on (a2b_ref_b = b_id) where a2b_ref_a=a_id), (select group_concat(d_card) from A2D join D on (a2d_ref_d = d_id) where a2d_ref_a=a_id)
from A;

--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to