I have a SQL Server tables with states in them and another table with states in them but multiple states in a cell:
StateTable1
Col 1 Col 2
Row1 FullName WA, OH, FL
GeographyTable2
Col 1 Col 2
Row1 Washington WA
Row2 Ohio OH
Row3 Florida FL
FinalResultingTable3
Col 1 Col 2
Row1 FullName WA
Row2 FullName OH
Row3 FullName FL
What I want to do is join the Geographycol2
table to Statecol2
table and return the final table where I basically return multiple rows for each state.
Maybe the join isn't the place to do this is there a way to transpose these csv into rows with the same fullname?
Thanks for the help
Attempted query (where Contact is State table):
Select Top 1000
Ct.fullname, Ct.ActiveLicenses, Geo.state
From
datawarehouse.wby_vw_dim.contact Ct
join
datawarehouse.wby_vw_dim.geography Geo on Geo.state like '%' + Ct.activelicenses + '%'
and this just returns one fullname infinite times