I'm trying to understand the grouping magic and testing the first and last query. Only thing is for some reason, I'm not getting any result for the last query. Perhaps i'm doing something wrong.
On 5/22/14, RSmith [via SQLite] <ml-node+s1065341n7578...@n5.nabble.com> wrote: > > > > 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 > > > > > _______________________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://sqlite.1065341.n5.nabble.com/Simple-Select-from-IN-from-a-newbie-tp75751p75785.html > > To unsubscribe from Simple Select from IN - from a newbie., visit > http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=75751&code=ZmFudGFzaWEuZG9zYUBnbWFpbC5jb218NzU3NTF8MTk4Njk4NTgwNw== -- View this message in context: http://sqlite.1065341.n5.nabble.com/Simple-Select-from-IN-from-a-newbie-tp75751p75786.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users