Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.