Show Related table with more fields
- Single Page
Posted 31 October 2017 - 03:38 AM
Posted 31 October 2017 - 06:12 AM
Well.. very frankly what i feel this is more like a report rather then a grid / listing for crud that you are looking into..
Reason - there may be 1-1 relation between patient - hospital .. fine with it..
but there will be 1-n relation between patient-comments
that is where the issue can technically come in.
If u planning to display the list in the comments table (to show the patient name / hospital name) .. rather then creating such complex scenarios - i will recommend u should add hospital_id in the comments table itself so it can be a straight join rather then sub join ..
i know you followed the method of normalization and it might be good as per the rules.. but at times for optimization / speed / performance, the solutions can be a result of denormalization.
As of your requirement - it is not possible with the standard flow / implimentation of the system .. ya there is 1 way ..
as for patient - u can do a join ..
and as for hospital - u can add a column hospital and make a callback on column to fetch the relevant hospital for the patient.
this is a hack you can surely use .. but aint recommended for optimum results.. hence u may re-think of denormalizing your structure and adding hospital_id in comments table.
Happy GCing :)