Here is my Database schema and the tables I am trying to link, I tried using a LEFT join but now it is creating a new result for each matched row.
https://i.stack.imgur.com/qItTW.png
I am currently building up my query and now trying to join these tables together (Procedure-> Procedure_event -> Resources -> Med_item)
In a scenario like this:
e.g. Procedure X has 3 rows procedure_events
I want the data returned to me in one record but with all the rows that make up that record.
However it is returning 3 rows of results like so:
- Procedure X - procedure_event row 1
- Procedure X - procedure_event row 2
- Procedure X - procedure_event row 3
So the query result should be Procedure X - procedureevent rows 1,2,3
This is my code in Codeigniter PHP framework using Active Record:
$this->db->join('procedure_event', 'procedure.procedure_id = procedure_event.procedure_id' , 'left');
Thanks