Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Puzzle
Message
 
 
À
28/11/2003 12:20:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00854130
Message ID:
00854256
Vues:
23
>Sergey,
>
>SQL 1 returns records that should not be in the file. The total returned should be 14 as SQL 2 statement would then duplicate each for Asia and Africa. I suspect the reason is you will find more than one record with the same genus and species if the same continent, but a different site. (Please bear with me, this is my daughter's data.)
>
Hi Ken,

Try this one.
SELECT genus, species, continent ;
	FROM species JOIN site ON species.pkey = site.fkey ;
	WHERE site.continent = 'Asia' ;
		AND genus + species IN ( ;
			SELECT genus + species ;
			FROM species JOIN site ON species.pkey = site.fkey ;
			WHERE site.continent = 'Africa' );
UNION  ;
SELECT genus, species, continent ;
	FROM species JOIN site ON species.pkey = site.fkey ;
	WHERE site.continent = 'Africa' ;
		AND genus + species IN ( ;
			SELECT genus + species ;
			FROM species JOIN site ON species.pkey = site.fkey ;
			WHERE site.continent = 'Asia' );
	ORDER BY 1,2 ;
	INTO CURSOR curAA
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform