Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need help understanding why this syntax does not work.I am given 3 tables where one references to the other two (in my case actors, movies, casting).So if I want to find the cast of a movie I try this
SELECT name FROM ACTOR A, MOVIE M, CASTING C WHERE MOVIE.title LIKE 'SO and SO' M.id = Casting.movieid A.id = C.actorid
But when I try and run it it says that
quote: FROM ACTOR A, MOVIE M, CASTING C *ERROR at line 2:
Am I using the "Actor A, Movie M, Casting C" wrong
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2009-10-11 : 22:01:44
SELECT name FROM ACTOR A, MOVIE M, CASTING C WHERE MOVIE M.title LIKE 'SO and SO'AND M.id = Casting C.movieidAND A.id = C.actorid
should use ANSI JOIN method
SELECT nameFROM ACTOR A INNER JOIN CASTING C ON A.id = C.movieid INNER JOIN MOVIE M ON M.id = C.actoridWHERE M.title LIKE 'SO and SO'
KH[spoiler]Time is always against us[/spoiler]
jason97m
Starting Member
4 Posts
Posted - 2009-10-12 : 04:01:13
Just for the sake of clarity, can you tell me what your foreign keys are that link together the tables?Jason MorrisBRIXTON.US