Subject | Re: Master-Detail query help, please... :) |
---|---|
Author | Greg At ACD |
Post date | 2005-09-29T15:55:22Z |
--- In firebird-support@yahoogroups.com, Ivan C Cruz <ivancruz@c...>
wrote:
scanned (PLAN (M NATURAL) ...), which is something to avoid since
there are a lot of records in TableMaster.
The idea hopefully would be avoid the table scan on the TableMaster
table by somehow getting the resulting list of MIDs from the child,
then joining this result to the master table to get the actual data.
That's where I'm struggling... :)
Thx for the thought, tho... I do appreciate it :)
Greg
wrote:
> Greg At ACD escreveu:That does work... the only problem is that TableMaster will be table
>
> >First try:
> >
> >SELECT M.*
> >FROM TableMaster M
> > INNER JOIN TableChild C ON M.MID = C.MID
> >WHERE C.SomeValue IN (A, B)
> >
> >
> >
> I'm not completely sure but, I believe what you want is
> simple that:
>
> SELECT M.*
> FROM TableMaster M
> WHERE Exists ( SELECT *
> FROM TableChild C
> WHERE M.MID = C.MID
> AND C.SomeValue IN (A, B) )
>
>
> Ivan.
scanned (PLAN (M NATURAL) ...), which is something to avoid since
there are a lot of records in TableMaster.
The idea hopefully would be avoid the table scan on the TableMaster
table by somehow getting the resulting list of MIDs from the child,
then joining this result to the master table to get the actual data.
That's where I'm struggling... :)
Thx for the thought, tho... I do appreciate it :)
Greg