Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not in statement
Message
De
03/03/2004 15:43:43
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00882687
Message ID:
00882882
Vues:
17
Tracy, since your illustration shows 2 records with the same key and different flags, it seems to make perfect sense that in the first 2 cases you will get identical results regardless whether you choose flag = .T. or flag = .F. In the 3rd case though, your (sele... flag) will produce the same key, but now you are looking for something that does not match that key. Therefore, no records. I'm not sure if this illustration is valid or not, but if you have identical keys with offsetting flags, then you pretty much have to get different results in the 3rd case compared to the 1st 2 cases.

Alan

>Tracy,
>
>Consider this:
>
>fld1    flag
>001     .t.
>001     .f.
>
>
>* this will give you two records
>Sele ... where IN (sele ... where flag)
>
>* this will give you two records
>Sele ... where IN (sele ... where NOT flag)
>
>* this will give you NO records
>Sele ... where NOT IN (sele ... where flag)
>
>>The below works:
>>
>>
>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name IN ;
>>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .T.);
>>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>>
>>
>>so does the reverse:
>>
>>
>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name IN ;
>>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .F.);
>>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>>
>>
>>However, the reverse of the first using NOT does not work, any idea why anyone?
>>
>>
>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>  WHERE !EMPTY(lcontrol.cn_name) .and. lcontrol.cn_name NOT IN ;
>>  (SELECT ctrlname FROM ctrlset WHERE ctrlset.printform = .T.);
>>  INTO TABLE (hdir+"tTEMPLCONTROL.DBF")
>>
>>
>>The 2nd two statements should produce the same results, but they do not. What is wrong with the "not in" portion?
>>
>>TIA,
>>Tracy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform