List:General Discussion« Previous MessageNext Message »
From:Jim McAtee Date:August 3 2003 7:32pm
Subject:Re: Nested SELECT statements problem
View as plain text  
----- 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?


Thread
Nested SELECT statements problemPascal Délisle3 Aug
  • Re: Nested SELECT statements problemDan Nelson3 Aug
    • Re: Nested SELECT statements problemInc Eternal Designs3 Aug
  • RE: Nested SELECT statements problemLin Yu3 Aug
    • Re: Nested SELECT statements problemPascal Délisle3 Aug
      • Re: Nested SELECT statements problemPascal Délisle3 Aug
        • Re: Nested SELECT statements problemJim McAtee3 Aug
          • Re: Nested SELECT statements problemPascal Délisle3 Aug
        • Re: Nested SELECT statements problemMatthew McNicol3 Aug
        • Re: Nested SELECT statements problemDan Nelson3 Aug
  • Re: Nested SELECT statements problemAdam Fortuno4 Aug