Re: VFP 9.1 Unions in subqueries by Cindy
Cindy
Thu Jan 11 14:52:02 CST 2007
Hi Jim,
Can you explain a little more what you're trying to do? It sounds like "rpl"
stands for "replacement" but you're joining on Agency being equal so what's
the difference between Agency in the main table and agency in either of the
errors tables.
Since you're doing a Union it looks like you can have two separate queries
against the replacement tables and Union them:
Create Cursor Ph(Source I, SrcRec I, Agency I)
Insert Into Ph Values (1, 1, 1)
Insert Into Ph Values (2, 2, 2)
Insert Into Ph Values (3, 3, 3)
Insert Into Ph Values (4, 4, 4)
Create Cursor HasOtherRecLevelErrs (Source I, SrcRec I, Agency I)
Insert Into HasOtherRecLevelErrs Values (1, 1, 1)
Insert Into HasOtherRecLevelErrs Values (2, 2, 2)
Create Cursor HasFieldLevelErrs (Source I, SrcRec I, Agency I)
Insert Into HasFieldLevelErrs Values (2, 2, 2)
Insert Into HasFieldLevelErrs Values (4, 4, 4)
Create Cursor PedHold (Agency I)
Insert Into PedHold Values (1)
Insert Into PedHold Values (2)
Insert Into PedHold Values (4)
Select Ph.Source, Ph.SrcRec, HasOtherRecLevelErrs.Agency ;
From Ph ;
Inner Join HasOtherRecLevelErrs On ;
Ph.Agency = HasOtherRecLevelErrs.Agency ;
Union ;
Select Ph.Source, Ph.SrcRec, HasFieldLevelErrs.Agency ;
From Ph ;
Inner Join HasFieldLevelErrs On ;
Ph.Agency = HasFieldLevelErrs.Agency ;
Into Cursor OthersToHoldDetail ReadWrite
--
Cindy Winegarden MCSD, Microsoft Most Valuable Professional
cindy@cindywinegarden.com
"Jim Czeb" <james.czebiniak@pearlcarroll.com> wrote in message
news:1168536327.473155.218800@i56g2000hsf.googlegroups.com...
> The following query works:
> select ph.Source, ph.SrcRec, rpl.Agency ;
> from ( ;
> select * ;
> from HasOtherRecLevelErrs ;
> union ;
> select * ;
> from HasFieldLevelErrs ;
> ) as rpl ;
> inner join PEDHold as ph ;
> on rpl.Agency=ph.Agency ;
> into cursor OthersToHoldDetail
>
> but when we try
> select ....... where in (select ...... with union here)
> does not work.
>
> What is the official policy on what is allowed. The documentation is
> sparce on this subject.
>