An SQL question

Ace_sq
04-18-2004, 06:01 PM
Hi :)


I'm trying to learn SQL code for myself, and have a question. This code is taken from a website:

SELECT * FROM casting, actor
WHERE casting.actorid=actor.id
AND actor.name='John Hurt'
Now obviously, this means that it shows everything from these two tables where the actor ID has a match and when the actor name is John Hurt.

However, what I want to do is have it where it will return where John Hurt is found in one or more of multiple fields within actor.

Every thing I try either brings up an error or gives out the wrong effect. Does anyone have any ideas?

reboot
04-18-2004, 08:19 PM
SELECT * FROM actor
INNER JOIN casting
ON actor.actorid=casting.id
WHERE actor.name='John Hurt'

wengwashere
04-18-2004, 10:32 PM
SELECT * FROM actor
INNER JOIN casting
ON actor.actorid=casting.id
WHERE actor.name='John Hurt'

more about JOINS :

http://www.w3schools.com/SQL/sql_join.asp

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum