I have a VIEW that queries my E-A-V model which uses datatype tables to store the values. I have an entity that contains many attributes, each attribute can be a different datatype. The DataType tables are all identically structured except for storage type they have 4 columns, required, Min, Max and Value (of the respective datatype for the table).
I would like simply get something like
MyAttributeName, Min, Max, Value, Required
I have tables like this..
- [Attribute:: Attribute_Id, Name] [Machine:: Machine_Id, Name]
- [Attribute_Val_Int :: Id, Attribute_Id, Machine_Id, Min, Max, Value,Required]
- [Attribute_Val_Dec :: Id, Attribute_Id, Machine_Id, Min,Max, Value, Required]
- [Attribute_Val_Dat :: Id, Attribute_Id, Machine_Id, Min, Max, Value, Required]
While I can get all of the Attribute Type Values (in this example I get 12 columns back - I want only the Attribute_Val that has non-null values. I would like the Column Names to then be aliased Min, Max, Val, Required
So instead of receiving this:
MachineName, MyAttributeName, IntMin, IntMax, IntValue, IntRequired, DecMin, DecMax, DecValue, DecRequired, DatMin, DatMax, DatValue, DatRequired.
I want to get:
[MachineName, MyAttributeName, Min, Max, Value, Required]