0

I have below MySQL database table which has a recursive relationship. A hospital maybe managed by another main hospital in this scenario. I have a difficult time trying to retrieve all data with name of the hospital which manages another hospital.

enter image description here

Some expert help would be much helpful for me. Thanks.

amsandun
  • 23
  • 1
  • 4
  • This may help: https://stackoverflow.com/questions/20215744/how-to-create-a-mysql-hierarchical-recursive-query – raphael75 Jun 20 '19 at 13:54
  • 2
    Is B H Gampola 'managed by' MSD? That is, the full chain needs to be walked through, not just one level? In MySQL 8.0 it is relatively easy with a "recursive CTE"; before that, it is messier. – Rick James Jun 20 '19 at 14:16
  • Possible duplicate: https://dba.stackexchange.com/questions/30021/mysql-tree-hierarchical-query – Jon of All Trades Jun 20 '19 at 15:18

0 Answers0