AlisdairO / pgexercises

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

self join logic question #33

Closed morenoh149 closed 7 years ago

morenoh149 commented 7 years ago

I recently solved https://pgexercises.com/questions/joins/self.html but from the problem description I thought the solution was

select distinct mems.firstname as firstname, mems.surname as surname
from cd.members mems inner join cd.members recs on mems.recommendedby=recs.memid
order by surname, firstname;

that is, we should return all the members that have been recommended by some other member. Meaning we should be selecting the members name not the recommender's name.

right?

AlisdairO commented 7 years ago

Hey,

There's some different wording on the question: 'How can you output a list of all members who have recommended another member'. It's 'have recommended', rather than 'have been recommended'.

Appreciate you taking the time to get in touch and send in a report!