I'm curious if any of you have a solution to this problem I'm facing. I have a table of products and a table of attributes. i can assign n number of attributes to a given product. So my table structure might look something like this:Product TableProductNumber, Field1, Field2, Field3ProductAttribute Table (bridge table -- 1 to many)ProductNumber, AttributeId, AttributeDateTimeAttribute TableAttributeId, AttributeCode
This is straight forward. However, this is where it gets tough. The attribute codes determine a "Status" for the product. So say some valid attribute codes are: "A", "B", "C". A or B = status1, C = status2. Also, a status can override another if its attribute date is more recent. so a product might have these codes assocated with it: A, C. I need to display query results in a grid view like this:ProductNumber, Field1, Field2, Field3, Status1,value, value, value, status12,value, value, value, status23,value, value, value, status1
how would you structure your tables / queries to accomplish this? Shoudl this logic be in a data view or should i return all the attributes and let the application determine the business rules? Just curious what solutions people might have.