Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting exact record match between datasets
Message
De
08/09/2005 12:34:51
 
 
À
08/09/2005 12:28:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01047673
Message ID:
01047759
Vues:
10
>>Hi Jay
>>
>>>In the SQL below, I'm using TransHist.iTransact to determine whether I want a result record or not. What I really need is to know if the exact record does not exist in TransHist, not just by using the iTransact field value. The same fields exist in the crsTestAcctContiUniCont cursor and the TransHist table. How would I do this?
>>>
>>>
>>>
>>>SELECT * ;
>>>	FROM crsTestAcctContiUniCont;
>>>	WHERE crsTestAcctContiUniCont.iTransact NOT IN (SELECT iTransact FROM TransHist) ;
>>>	INTO CURSOR crsUpdate
>>>
>>
>>
>>If I'm reading you right, this will give all crsTestAcctContiUniCont records that have a match in TransHist (using the iTransact) but differ in any one of the other fields. It will also union in all the crsTestAcctContiUniCont records that have no match in TransHist. If I remember correctly the ORs will stop processing as soon as any one of them is true.
>>
>>
>>select ;
>>    TA.* ;
>>  from ;
>>    crsTestAcctContiUniCont TA ;
>>  inner join ;
>>    TransHist TH ON ;
>>      TA.iTransact = TH.iTransact ;
>>      AND (TA.Field1 # TH.Field1 ;
>>       OR TA.Field2 # TH.Field2 ;
>>       OR TA.Field3 # TH.Field3 ... ) ;
>>union ;
>>  select ;
>>    TA.* ;
>>  from ;
>>    crsTestAcctContiUniCont TA ;
>>  where ;
>>    TA.iTransact NOT IN (SELECT TH.iTransact FROM TransHist TH)
>>
>
>Mike,
>Unfortunately OR/AND doesn't stop in SQL (hope I'm wrong and ith has changed). A "join on ..." is likely to C...5 with too many fields to compare.
>Cetin

It change in VFP9
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform