The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to do this ?

Discussion in 'Database Discussions' started by TheFuzzyBear, Oct 6, 2011.

  1. TheFuzzyBear

    TheFuzzyBear Member

    Joined:
    Sep 21, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi Everyone,

    Bear with me. I'm a novice when it comes to SQL but I'm wondering how exactly to do the following. I have access to mySQLAdmin under cPanel and using the wildcard option for the table lm_users I requested it find all emails in the DB that = 'myemail.com' -- I then hit GO and it actually generated for me all entries that exist in the database which actually match that criteria.

    Now the tricky part. I also noticed that mySQLAdmin generates the SQL code used to run that query. I also know that there is a field in that record called cnf which holds a state for the record where 1 means active and 2 means removed. Now this is what I want to do but not sure HOW TO DO IT...

    I would like to modify the existing query to SELECT all records that match my query (the exact email I request) but then I want to UPDATE the database by changing that one field cnf by setting it to the value of 2 for all records found. Can you do this all in one SQL command?

    Here's the initial query

    SELECT *
    FROM `lm_users`
    WHERE `email` = CONVERT( _utf8 'risawalsh@aol.com'
    USING latin1 )
    COLLATE latin1_swedish_ci
    LIMIT 0 , 30

    and here's the update that I want to add

    UPDATE `internet_listmailPro`.`lm_users` SET `cnf` = '2'

    Ideally then is all I need to change is the email and the those emails found would have their status
    changed from cnf=1 to cnf=2.

    How do I do this within the contact of using the mySQLAdmin interface.

    Many thanks in advance.

    Christopher :)
     

Share This Page