matthewhaworth Posted March 21, 2009 Share Posted March 21, 2009 I have two tables. user_employment employment The relationship is on the field "employID" many user_employments to one employment. The basic structure (just the field that matter) are as follows: user_employment['employID', 'userID'] employment['employID', ... ,'current'] The field 'current' is enum(0, 1) (i.e. it can only be 0 or 1). What I want my query to do is find the employment record that is equal to 1 for a specific user, and make it equal to 0. Pseudo Code: UPDATE employment SET current = 0 WHERE employID = [the employID that is associated with the specified user, $userID] Thanks Link to comment https://forums.phpfreaks.com/topic/150459-sql-query-i-just-cant-figure-out/ Share on other sites More sharing options...
FaT3oYCG Posted March 22, 2009 Share Posted March 22, 2009 erm i dont understand what you are asking here as the query is simple enough dont you think simply UPDATE employment SET current = 0 WHERE employID = [the employID that is associated with the specified user, $userID] which is what you have so im unsure of what you are asking? please elaborate Link to comment https://forums.phpfreaks.com/topic/150459-sql-query-i-just-cant-figure-out/#findComment-790746 Share on other sites More sharing options...
Darno7 Posted March 22, 2009 Share Posted March 22, 2009 UPDATE employment SET current = 0 WHERE current = 1 AND employID = $userID ? Link to comment https://forums.phpfreaks.com/topic/150459-sql-query-i-just-cant-figure-out/#findComment-790827 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.