maxwell2323
Programmer
USING TSQL on SSMS 2005
I have a table with entries in two columns: Location, Widget. I want to get a second table that has rows of all locations with all widgets. Or I could settle for a table (with the two columns) that has Locations where the rows for the locations have a widget where the location/widget is not in the original table. I would have to write code where nothing can be hard coded, as the number of Locations and/or widgets are dynamic. I apologize if I have to post this twice - not sure if an attachment is better. Remember - even though you see 3 distinct locations and 4 distinct widgets, these distinct numbers can vary. How do I code for this? I am trying to do an outer join on the same table but it is not working. Thanks so much in advance.
Original Table
Location| Widget
Chicago | P
Carmel | A
Carmel | B
Indy | A
Indy | B
Indy | C
Table I am wanting:
Location| Widget
Chicago | A
Chicago | B
Chicago | C
Carmel | C
Carmel | P
Indy | P
I have a table with entries in two columns: Location, Widget. I want to get a second table that has rows of all locations with all widgets. Or I could settle for a table (with the two columns) that has Locations where the rows for the locations have a widget where the location/widget is not in the original table. I would have to write code where nothing can be hard coded, as the number of Locations and/or widgets are dynamic. I apologize if I have to post this twice - not sure if an attachment is better. Remember - even though you see 3 distinct locations and 4 distinct widgets, these distinct numbers can vary. How do I code for this? I am trying to do an outer join on the same table but it is not working. Thanks so much in advance.
Original Table
Location| Widget
Chicago | P
Carmel | A
Carmel | B
Indy | A
Indy | B
Indy | C
Table I am wanting:
Location| Widget
Chicago | A
Chicago | B
Chicago | C
Carmel | C
Carmel | P
Indy | P