Re: SQL Ignorance
- From: Bob Quintal <rquintal@xxxxxxxxxxxxx>
- Date: 03 Jun 2007 16:33:52 GMT
Alan Forsyth <Not@xxxxxxxx> wrote in
news:Xns9944A879D279ANotiHomenz@xxxxxxxxxxxxxx:
I've been asked by a friend to help with his Movie database.[snip]
It's an informal home user record of his own movie watching
history. He's asked me to write a particular query, and I'm
stumped.
I have two questions.
Here's Question 1.
Obviously (?), the WHERE Clause could be applied to either
(tblActor.ActorID in the Actor Table,) or
(tblMovieActor.ActorID in the JOIN Table.)
Which (if either) is "right", or conceptually better?
When querying on an outer join (left or right) one puts the
criteria in the predominant table, (that's the one that should
return all records). The reason for that is that when you query
on the limited table, (the one having matching records), unless
you specifically handle the null records, the query essentially
returns the same records as an inner join
so your FROM statement
RIGHT JOIN
(tblActor
RIGHT JOIN
tblMovieActor)
implies that you should use tblMovieActor.
However, if you used proper referential integrity, you should
not have any tblMovieActor rows with no corresponding actor or
movie, making the whole point of right join moot.
The question may be either complex or trivial. I'm still
learning about types of Join and how to use them. With luck I
hope to learn enough to answer my second question myself.
Question 2
How do I write a query that ...
My explanation is going to be bad. Sorry.
Assume Clint Eastwood is ActorID 42
The tblMovie has a Memo field IMDBInfo.
This contains information about the Movie, and mentions other
Actors in the Movie.
For example, MovieID 64 named "I made this Title Up." (linked
to Rowan Atkinson ActorID 32 as an Actor in MovieID 64) may
have this text: "... Shirley Temple, Clint Eastwood, Rowan
Atkinson, Fred Dagg, ..."
Here's the question.
I want the query to select each Actor and (say) in the test
for Clint Eastwood, return the MovieID 64 because Clint
Eastwood is in the IMDBInfo field.
I think if I could ask the question properly I'd be a few
steps closer to the answer.
Any clues, anyone? Including, I suspect, Clue Number One.
I can get a result by creating a new table in code using
nested RecordSets, but I'd like to know at least if a Query is
possible.
Thanks,
Alan
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: SQL Ignorance
- From: Alan Forsyth
- Re: SQL Ignorance
- References:
- SQL Ignorance
- From: Alan Forsyth
- SQL Ignorance
- Prev by Date: Query (Add,Subtract)
- Next by Date: Re: iif Function in query criteria
- Previous by thread: SQL Ignorance
- Next by thread: Re: SQL Ignorance
- Index(es):
Relevant Pages
|