Pedro Quaresma de Almeida wrote:
The first question I have is what version of MySQL are you using?
Subqueries (which is what you're trying to perform) are only supporting
in MySQL 4.1 and above.
I have two MySQL databases, on for aeromodelistas (aeromodelling) and
another for Códigos Postais (Postal Codes). I whant to do the
SELECT CódigoPostal FROM Aeromodelistas
WHERE CódigoPostal IN
(SELECT distinct(CP4) FROM codigopostal.LOCART,codigopostal.DISTRITO
This query is not working, and I do not know why. If I try the two
queries individualy they work, togheter they don't!?
But the question I want to put to the members of this list is the
following. Is it possible to do the following?
// first do the subquery
$sql_CP4s = "select distinct(CP4) from
$resultado_CP4s = mysql_query($sql_CP4s,$ligacao);
$linha_CP4s = mysql_fetch_assoc($resultado_CP4s);
// then use it's results in the main query
$sql_Aero_Dist_Masc = "select count(Nome) from Aeromodelistas where
year(AnoQuota)=2005 and Sexo='Masculino' and Distrito IN $linha_CP4s";
How can we include the results (not just one) of one query in another
Is it possible?
If you do not have MySQL 4.1 or higher installed, you will not be able
to perform the query as you have it above, but rather, you might
consider a way of performing the same query as a JOIN. I didn't inspect
your query heavily, so I don't know if it's possible or not.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php