On 2014/05/22 14:28, Humblebee wrote:
Thanks for your answers.
Wow, I just tried the "Group" thing and it's truly magic. Big Bang !
The first query gave the Exact answer I was looking for. It even
assembled a string.
Amazing how this works.
I agree :)
Is the last query the equivalent of the first query?
Ref:
SELECT group_concat(P.id,','), group_concat(P.name,',')
FROM TeamPersonTable TP
LEFT JOIN PersonTable P ON P.id=TP.personId
WHERE TP.teamid=1
GROUP BY TP.teamid;
vs.
SELECT T.id AS TeamID, T.name AS TeamName, P.id AS PersonID, P.name AS
PersonName
FROM TeamPersonTable TP
LEFT JOIN PersonTable P ON P.id=TP.personId
LEFT JOIN TeamTable T ON T.id=TP.teamId
WHERE P.id=5;
Yes it is equivalent in principle I think - obviously the selected fields and criteria changed, and the first one groups and csv's
it, while the last one lists them one by one - Is this what you meant?
Add some more test data and run all the queries, the differences/similarities
will become very clear.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users