I do not think it is going to work, you may want to stick with the PHP script. MySQL says that is going to enable subqueries from version 4.1 and the most recent release is 4.0.16 or 4.0.17. A question and 2 comments: q: the teams are fixed within league? c1: it is not clear how you record the goals of a team against of another. 2. you may want to check the sizes of some fields; some are too big, or too small. Mihai On Wed, 31 Dec 2003, Kirk Babb wrote: > If (in MySQL) I have to select 'playerID' from the table soccer.players > based on lname='smith', fname='john', and dob='1988-12-02' and THEN update > soccer.teams 'coachID' equal to the result of the select statement, can I do > it all in one query? > > Or must I let my PHP script execute a select, grab the result, and then run > the update statement? > > The scenario is this: I've just created the player record in soccer.players > (it's an adult league, so a player could also be the coach) and need to grab > that playerID to insert into the coachID section of soccer.teams. > > Here's the definitions for my tables if it would help you follow my question > (with thanks to Micah for the structural assistance): > divisions > Table comments : league division names with identifier > > Field Type Null Default > divisionID int(11) No > division_name varchar(15) No > > players > Table comments : player registration and statistical info > > Field Type Null Default > playerID int(11) No > lname varchar(20) No > fname varchar(20) No > teamID int(11) No 0 > dob date No 0000-00-00 > address varchar(40) No > telephone int(9) No 2147483647 > email varchar(40) No > sex enum('m', 'f') No m > yellow int(2) No 0 > red int(2) No 0 > disc_notes text Yes NULL > goals_scored int(2) No 0 > own_goals int(2) No 0 > > teams > Table comments : Team registration and statistical info > > Field Type Null Default > teamID int(11) No > team_name varchar(20) No > pwd varchar(7) No > coachID int(11) No 0 > divisionID int(11) No 0 > paid enum('y', 'n') No n > pmnt_notes text Yes NULL > win int(2) No 0 > loss int(2) No 0 > tie int(2) No 0 > goals_for int(2) No 0 > goals_against int(2) No 0 > > > Thanks for your help! > > Kirk > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php