I have a sql server table with the following data:
PrimaryKey ForeignKey DataType Value
1 1 Actor abc
2 1 Movie efg
3 1 Movie hij
4 2 Actor mno
5 2 Movie pqr
6 2 Movie stu
7 2 Movie vwx
I want to select the data from this table and load a Csharp class, named Actors
. The class has a property called ActorName
and a collection of movies by the actor. Essentially I have to populate the ActorName
with data in the Value column and collect all the movie names by the actor from the Value column and populate the collection. I am not sure how to do that, especially how to write the appropriate sql select statement.
Thanks