AlisdairO / pgexercises

PostgreSQL Exercises web site code
Other
400 stars 62 forks source link

Add a sub-query option #31

Closed dimidd closed 7 years ago

dimidd commented 7 years ago

Hi, I've solved this exercise using a sub-query instead of a join: select distinct cd.members.firstname, cd.members.surname from cd.members where cd.members.memid in (select distinct cd.members.recommendedby from cd.members) order by cd.members.surname;

And I wonder if it makes sense to add it as another option to the explanation, since this this section deals with joins.

AlisdairO commented 7 years ago

Hey, this is a perfectly reasonable approach to the problem, but as I recall I haven't really introduced subqueries at this point - so I'd rather avoid overloading the reader.

Thanks a lot for raising the issue, I appreciate your input!