Jump to content

updating table query


Justafriend
Go to solution Solved by Barand,

Recommended Posts

Ok i have a table with headings

username   useremail   randomnumber   neptune   morethen5

 

 

What im trying to do is if a username has more than 5 records where neptune isnt null update  the morethan5 column for all username with yes

 

this is the query i have


update ballot
set morethan5 = yes
where username in
(
  select * from
  (
    select neptune
    from  ballot
    group by username
    having count(1) > 5
  ) x
)

i got first of all an error saying yes  column didnt exist so i created a new column called yes  and it isnt updating any records

Link to comment
Share on other sites

that fixed the error  but its still not updating the column  here is an example of  the table

 

 

 

 pie me@me.com 46276 \N  
taz me@me.com 49042 \N  
taz me@me.com 49042 \N  
wicked me@me.com 41494 \N  
wicked me@me.com 41494 \N  
nnn me@me.com 38915 neptune  
nnn me@me.com 38808 neptune  
nnn me@me.com 38915 neptune  
nnn me@me.com 38808 neptune  
nnn me@me.com 38915 neptune  
nnn me@me.com 38808 neptune  

what im trying to do is count how many  for each username that has  a non null  in the column neptune and if ithe same player has more then 5 Non Null values to mark the morethan5 column with yes

Edited by Justafriend
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.