Jump to content

some help please


advo

Recommended Posts

hi  i have been having a issue that for life of me just isnt sitting in my head right

 

i have a table called `ranks` with a persons `userID` and various ranks inside it like income whatnotthis table holds there main rank under field `rank`

 

there userinformation is help in `userdeatials` i added a fields called `glorypoints`

 

now what im trying to do is if say there rank is below between 1- 10 give them 2 glory points if 11-50 give them 1

and those above that get nothing

 

now this is what i have and it dose not update the proper parts of table ie rank 1-50 every one is getting them 

 

this is the code im using\

 

UPDATE userdetails SET glorypoints = glorypoints+'2' WHERE rank > 11 AND rank < 50 AND ranks.userID=userdeatils.ID

 

 

Link to comment
Share on other sites

you are refering to a table rank  "AND ranks.userID=userdeatils.ID" but you have not have joined it

 

so off the top of my head:

 

UPDATE userdetails Inner Join rank On rank.userID = userdeatils.ID

SET glorypoints = glorypoints+'2' WHERE rank > 11 AND rank < 50 AND ranks.userID=userdeatils.ID

 

 

 

 

Link to comment
Share on other sites

what do you mean CASE please explain am i doing it right or wrong some one help please

CASE

WHEN rank > 11 AND rank < 50 THEN glorypoints = glorypoints + 1

WHEN rank > 0 AND rank < 12 THEN glorypoints = glorypoints + 2

END CASE

 

...etc.

Link to comment
Share on other sites

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.