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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 please,solve the problem

Author  Topic 

DARSHAN
Starting Member

2 Posts

Posted - 2010-09-08 : 11:34:30
3a. Obtain the cast list for 'Casablanca'. Use the id value that you obtained in the previous question.
actor(id, name)
casting(movieid, actorid, ord)

id = 27
I wrote
select name from actor join casting on (actor.id=casting.movieid) where id = 27
but it says wrong.
please,write the correct query.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 11:35:23
Show us what you got so far.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

DARSHAN
Starting Member

2 Posts

Posted - 2010-09-08 : 11:50:47
i updated my response.please,somebody give me correcr query.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 11:52:08
actor.id=casting.actorid

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-09-08 : 14:18:26
Homework? Seems to be a lot of that going around lately.

If so, may I suggest you go back to your coursework and revise the section on joins

--
Gail Shaw
SQL Server MVP
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 14:47:04
It's only September, and they already need help. I can't imagine what kind of stuff we'll get as they get further into the semester. You'd think the easy stuff in September wouldn't appear on these sites as it should be easy enough for them to figure out on their own.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-09-08 : 16:13:30
There isn't an ID on the casting table so your where clause will actually be filtering on actor.Id

If you are asking this level of question and having this much difficulty you need to go back and study the basics. You query should probably look like

SELECT
a.[name] AS [Actor Name]
FROM
casting AS c
JOIN actor AS a ON a.[id] = c.[actorid]
WHERE
c.[movieid] = 27

(Note this sql is transact specific take out the square brackets and it'll work on most anything (probably))


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -