I'm looking for an elegant way to select fields from a view, where a second supporting table defines the fields that should be selected.
The view contains all of my employee data. The constraint table contains the field name, which references the view field name, and a bit which signifies to select that field.
Example of View:
Name | Age | Weight
Peter | 38 | 180
Martha | 25 | 115
Example of constraint table:
Field | Enabled
Name | 1
Age | 0
Weight | 1
...Where after running the query, the following data should return:
Name | Weight
Peter | 180
Martha | 115
Any ideas on how to approach this?
Thanks!