Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Puzzle
Message
 
 
To
28/11/2003 12:20:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00854130
Message ID:
00854459
Views:
19
>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.)
>
>Ken
>
>
Ken,

Try this one
* #1
SELECT genus, species, COUNT(DIST continent) AS ContCount ;
	FROM species 
		JOIN site ON species.pkey = site.fkey ;
	WHERE site.continent IN( 'Asia', 'Africa') ;
	GROUP BY 1,2 ;
	HAVING ContCount = 2 ;
	INTO CURSOR curBoth
...
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform