I have 2 cursors
cursor1 contains a list of keys
cursor2 contains another list of keys

the key in both cursors is the very same format

I want to create another cursor cursor3
Which contains keys in cursor1 that are not in cursor2

This is the code.

It has always worked up to now.
Why does it not work in VFP9?


SELECT * FROM cursor1 ;
WHERE (curkey NOT in (SELECT WTAKEY FROM cursor2) );
INTO CURSOR cursor3

Re: SQL Select - exclusion list by David

David
Wed Mar 23 09:05:17 CST 2005

Tony,

Are you getting an error? Are you getting an unexpected result? I get two
records selected in all three cases below:

create cursor x1 ( i1 i )
insert into x1 values ( 1 )
insert into x1 values ( 2 )
insert into x1 values ( 3 )
insert into x1 values ( 4 )

create cursor x2 ( i2 i )
insert into x2 values ( 6 )
insert into x2 values ( 5 )
insert into x2 values ( 4 )
insert into x2 values ( 3 )

select x1.* ;
from x1 ;
into cursor x3 ;
where x1.i1 not in ( select i2 from x2 )

select x1.* ;
from x1 ;
into cursor x3 ;
where ( x1.i1 not in ( select i2 from x2 ) )

select x1.* ;
from x1 ;
where ( x1.i1 not in ( select i2 from x2 ) ) ;
into cursor x3

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


"Tony R" <TonyR@discussions.microsoft.com> wrote in message
news:85D091EF-5EE9-4459-8D9C-26AFB6F0557D@microsoft.com...
>I have 2 cursors
> cursor1 contains a list of keys
> cursor2 contains another list of keys
>
> the key in both cursors is the very same format
>
> I want to create another cursor cursor3
> Which contains keys in cursor1 that are not in cursor2
>
> This is the code.
>
> It has always worked up to now.
> Why does it not work in VFP9?
>
>
> SELECT * FROM cursor1 ;
> WHERE (curkey NOT in (SELECT WTAKEY FROM cursor2) );
> INTO CURSOR cursor3
>
>



Re: SQL Select - exclusion list by TonyR

TonyR
Wed Apr 20 06:03:02 CDT 2005

Thanks,

it seems I was running the program in VFP9 and it didn't work.
when I recompiled in VFP8 it works again.

go figure...


"David Frankenbach" wrote:

> Tony,
>
> Are you getting an error? Are you getting an unexpected result? I get two
> records selected in all three cases below:
>
> create cursor x1 ( i1 i )
> insert into x1 values ( 1 )
> insert into x1 values ( 2 )
> insert into x1 values ( 3 )
> insert into x1 values ( 4 )
>
> create cursor x2 ( i2 i )
> insert into x2 values ( 6 )
> insert into x2 values ( 5 )
> insert into x2 values ( 4 )
> insert into x2 values ( 3 )
>
> select x1.* ;
> from x1 ;
> into cursor x3 ;
> where x1.i1 not in ( select i2 from x2 )
>
> select x1.* ;
> from x1 ;
> into cursor x3 ;
> where ( x1.i1 not in ( select i2 from x2 ) )
>
> select x1.* ;
> from x1 ;
> where ( x1.i1 not in ( select i2 from x2 ) ) ;
> into cursor x3
>
> --
> df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro
>
>
> "Tony R" <TonyR@discussions.microsoft.com> wrote in message
> news:85D091EF-5EE9-4459-8D9C-26AFB6F0557D@microsoft.com...
> >I have 2 cursors
> > cursor1 contains a list of keys
> > cursor2 contains another list of keys
> >
> > the key in both cursors is the very same format
> >
> > I want to create another cursor cursor3
> > Which contains keys in cursor1 that are not in cursor2
> >
> > This is the code.
> >
> > It has always worked up to now.
> > Why does it not work in VFP9?
> >
> >
> > SELECT * FROM cursor1 ;
> > WHERE (curkey NOT in (SELECT WTAKEY FROM cursor2) );
> > INTO CURSOR cursor3
> >
> >
>
>
>