Re: MySQL - Query within a query

From: Date: Sat, 19 Mar 2005 15:04:30 +0000
Subject: Re: MySQL - Query within a query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38966@lists.php.net to get a copy of this message
I am looking to do the following w/ MySQL and PHP. Have 1 query that gets results, then use those results in another query: $l = 2; $result1 = ("SELECT * FROM Drivers WHERE League = $l"); $result2 = mysql_query("SELECT DriverID, Driver, CarNbr FROM Drivers LEFT JOIN $LeagueList ON Drivers.DriverID = $Result1.DriverID WHERE $Result1.DriverID) Is Null ORDER BY Drivers.DriverID");
If you're using MySQL 4.1, which supports subqueries, you might be able to write this all up as one nice query (using a sub-select). Larry

« previous php.db (#38966) next »