Jump to content

SQL query I just can't figure out


matthewhaworth

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.