I have three tables! One of them being a relationship table!
They are:
Treatment:
RelationshipbetweenPersonandTreatmenttable:
I would like to pass the ID of the person, the query would return the NAMES of the selected treatments. Example: ID 8, he would return Reiki and Astrology; ID 9, he would return Reiki, Astrology and Personal Development Coaching!
I've tried the query by putting Distinct
, but it's not working! It's like he's returning two results (which I hope are two results even) but that's all coming from the other treatments as well.
My code snippet:
Select * FROM tratamento INNER JOIN pessoa_tratamento_r ON 8 = pessoa_tratamento_r.ID_PESSOA
Thanks in advance for your help! And please, if you want to put links or other indications to study, do it! If there are other ways also to do this research, please say!