Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting exact record match between datasets
Message
De
08/09/2005 11:27:18
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
08/09/2005 09:11:37
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
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:
01047728
Vues:
9
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform