Is this kind of querry possible in MySQL?
| From: | Andy | Date: | Mon, 07 Jan 2002 13:49:51 +0000 |
| Subject: | Is this kind of querry possible in MySQL? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15493@lists.php.net to get a copy of this message | ||
Hi there,
I have a user table which contains province and country.
Another table named provinces contains this fields to and also the name of
the province.
Now I am trying to find out the provinces user are registered coming from a
special country. Unfortunatelly this statement underneath:
$stmt= "
SELECT DISTINCT c.province, c.province_id
from $DB2.$geo_T2 c, $DB.$T5 U
WHERE U.province_id = c.province_id AND c.country_code = '$country'
";
returns to much provinces. Thats because it is selecting all province_ids
from the user table and not only the ones with the proper country.
I guess there has to be a subselect ore something like this.
Maybe one of you guys have an idea.
Cheers Andy