Create multiple SQL views based off unique members in table
Posted on 2013-06-26
I have a table in SQL Server 2008 R2 that I would like to create multiple views from.
Basically, for each distinct value in a column, I would like to create a view with the name of that value. Each view will have the same columns as the original table, but with only the rows where the column=unique value.
Example in included picture.
View = CountyA with rows 1-2
View = CountyB with row 3
View = CountyC with rows 4-8
View = CountyD with row 9
View = CountyE with row 10
View = CountyF with row 11
What would be the best way to go about writing this query?