Scenario:
1. I have a table of customers (id, company, parent)
2. One of the columns is "parent" which can be another id.
3. I would like a VIEW of customers that shows the parent company if the parent field contains data, otherwise it shows the child company (i.e. parent overrides child)
E.g. table is:
Bob, <null>, Bill
Bill, Microsoft, <null>
So view should show
Bob, Microsoft
Bill, Microsoft
A really clever solution would be one that recurses up the tree, but actually it is not necessary as I only anticipate one level.
1. I have a table of customers (id, company, parent)
2. One of the columns is "parent" which can be another id.
3. I would like a VIEW of customers that shows the parent company if the parent field contains data, otherwise it shows the child company (i.e. parent overrides child)
E.g. table is:
Bob, <null>, Bill
Bill, Microsoft, <null>
So view should show
Bob, Microsoft
Bill, Microsoft
A really clever solution would be one that recurses up the tree, but actually it is not necessary as I only anticipate one level.