I have a table with item data. My columns are as follows: Style, Color, Gender, TotalSalesWhat I would like to end up with is a complete record set of how the data all relates to eachother. So, if a given style shares a color, and gender with other styles, then those styles are said to be related. For example if Style1 is black and meant for women, and Style5 is also black and meant for women, then those styles are related styles.The record set I would like will be a fully extrapolated record set showing EACH Style in the table and all of the styles that it is associated with. So if Style1, Style13, and Style16 are all related, then the recordset would look like this:Style1, Style13Style1, Style16Style13, Style1Style13, Style16Style16, Style1Style16, Style13
I don’t know what is the best way to end up at the resulting data. Not sure if I can do it with some sort of complex SELECT statement or if I’ll need some T-SQL procedure. Here is what I have so far:SELECT Style, Color, Gender, TotalSales ROW_NUMBER() OVER ( PARTITION BY [Color], [Gender] ORDER BY [TotalSales] DESC ) AS RankFROM RelatedData