Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting exact record match between datasets
Message
De
08/09/2005 10:12:47
 
 
À
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:
01047689
Vues:
10
>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 have understood.

This is not sure,
if you want a sure code you should compare all the fields:
CREATE CURSOR myCursor (PK I, aa i, bb c(20),ZZ M)
INSERT INTO myCursor VALUES (1,3,'AAA','M')
INSERT INTO myCursor VALUES (2,4,'AAA','H')
INSERT INTO myCursor VALUES (3,5,'AAA','H')

CREATE CURSOR myCursor2 (PK I, aa i, bb c(20),ZZ M)
INSERT INTO myCursor2 VALUES (1,3,'AAA','M')
INSERT INTO myCursor2 VALUES (2,5,'AAA','H')
INSERT INTO myCursor2 VALUES (3,5,'AAA','I')

IF VERSION(5)<900
	SELECT pk,SYS(2017,"pk",0,3) crc32 FROM myCursor INTO CURSOR T1
	SELECT pk,SYS(2017,"pk",0,3) crc32 FROM myCursor2 INTO CURSOR T2
	
	SELECT myCursor.* FROM T1 ;
		LEFT JOIN T2;
		ON b.pk=a.pk AND T2.crc32=T1.crc32;
		JOIN myCursor ON myCursor.PK=T1.PK;
		WHERE T2.PK IS NULL	
	USE IN T2
	USE IN T1
ELSE

SELECT myCursor.* FROM (SELECT pk,SYS(2017,"pk",0,3) crc32 FROM myCursor) T1 ;
		LEFT JOIN (SELECT pk,SYS(2017,"pk",0,3) crc32 FROM myCursor2) T2;
		ON T2.pk=T1.pk AND T2.crc32=T1.crc32;
		JOIN myCursor ON myCursor.PK=T1.PK;
		WHERE T2.PK IS NULL
ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform