Since I'm new to mySQL, could you point me how to create temporary tables dynamically?

Le dimanche, 3 aoû 2003, à 15:32 Canada/Eastern, Jim McAtee a écrit :

----- Original Message -----
From: "Pascal Délisle" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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?



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to