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