----- Original Message -----
From: "Pascal Délisle" <masterpace@stripped>
To: <mysql@stripped>
Sent: Sunday, August 03, 2003 1:02 PM
Subject: Re: Nested SELECT statements problem
> Finally, I solved my problem by creating a temporary table that holds
> the result of the subquery. So, it looks like this:
>
>
> CREATE TABLE livreTemp (IDLivre int(11));
>
> INSERT INTO livreTemp (IDLivre) SELECT book.IDLivre
> FROM livre book, livreEcritPar ecr, auteur aut WHERE aut.Prenom like
> '%$firstName%' AND aut.Nom like '%$lastName%' AND ecr.IDAuteur =
> aut.IDAuteur AND book.IDLivre = ecr.IDLivre;
>
> SELECT book.IDLivre, aut.Prenom, aut.Nom FROM livreTemp book,
> livreEcritPar ecr, auteur aut WHERE ecr.IDLivre= book.IDLivre AND
> aut.IDAuteur=ecr.IDAuteur;
>
> DROP TABLE livreTemp;
>
> The only problem I see is when there are concurrent access to the table
> "livreTemp", e.g. when there are multiple simultaneous requests of that
> kind. Is there a better way for achieving this under mySQL 3?
Can you dynamically generate a unique name for your temporary table?