Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Puzzle
Message
From
28/11/2003 11:31:12
 
 
To
28/11/2003 10:12:48
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00854130
Message ID:
00854231
Views:
20
Hi Walter,

------------
SELECT genus, species, continent ;
    FROM Species P INNER JOIN Site S ON P.Pkey = S.fkey AND S.continent IN ('Africa','Asia') ;
    WHERE EXISTS (SELECT * FROM Site WHERE fKey = P.Key AND Continent = 'Asia') AND ;
          EXISTS (SELECT * FROM Site WHERE fKey = P.Key AND Continent = 'Africa') ;
    ORDER BY 1,2
------------

If i want a general solution, then:
SELECT genus, species, continent ;
	FROM Species P JOIN Site S ON P.Pkey = S.fkey AND S.continent IN (ContinentList) ;
	WHERE P.Pkey IN (SELECT fkey FROM Site WHERE Continent IN (ContinentList) GROUP BY 1 HAVING COUNT(*)=ContinentListCount) ;
	ORDER BY 1,2
This support 24 elements.

Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform