I have a table listing movies with (among other things) multiple actors in each movie referenced by the ActorID from an Actors table.Here's part of my (non-working) SELECT statement:SELECTm.MovieID,m.Title,m.Act1ID,a.actFName + ' ' + a.actLName AS Actor1,m.Act2ID,a.actFName + ' ' + a.actLName AS Actor2,m.Act3ID,a.actFName + ' ' + a.actLName AS Actor3,m.Act4ID,a.actFName + ' ' + a.actLName AS Actor4FROM Movies mLEFT JOIN Actors a ON m.Act1ID = a.ActID--With below ANDs, get NULL for all names--AND m.Act2ID = a.ActID--AND m.Act3ID = a.ActID--AND m.Act4ID = a.ActID--With below additional LEFT JOINS on the Actors table, get error:-- The correlation name 'a' is specified multiple times in a FROM clause.LEFT JOIN Actors a ON m.Act2ID = a.ActIDLEFT JOIN Actors a ON m.Act3ID = a.ActIDLEFT JOIN Actors a ON m.Act4ID = a.ActIDORDER BY m.Title
You can get an idea of the structure of the tables from the code above.Basically it's:MOVIE tableMovieID int, PKEYTitle varchar(50)Act1ID intAct2ID intAct3ID intAct4ID intACTOR tableActID int, PKEYActFName varchar(50)ActLName varchar(50)You may be able to tell by the code above, but my question is, how do I get multiple rows (Actor records) from the Actors table for the same row (Movie record) in the Movies table?I want my query result to be something like:(MovieID - From Movies table): 1(Title - From Movies table): Star Wars: Episode IV - A New Hope(Act1ID - From Movies table): 1(Actor1 - From Actors table): Mark Hamil(Act2ID - From Movies table): 2(Actor2 - From Actors table): Harrison Ford(Act3ID - From Movies table): 3(Actor3 - From Actors table): Carrie FischerAny help will be greatly appreciated!Thanks=====================================f u cn rd ths, u cn gt a gd jb n prgrmng