+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Mysql Update where value = AnyNumber in Coding and Web Development; Is it possible to use UPDATE and set the WHERE to only UPDATE where the value = ANYNUMBER? For Example: ...
  1. #1

    Join Date
    Apr 2006
    Location
    UK
    Posts
    939
    Thank Post
    39
    Thanked 70 Times in 54 Posts
    Rep Power
    29

    Mysql Update where value = AnyNumber

    Is it possible to use UPDATE and set the WHERE to only UPDATE where the value = ANYNUMBER?

    For Example:

    UPDATE user_accounts set password_reset = 1 where user_ID = NumericValue?

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,406
    Thank Post
    639
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    324
    If it's a User_ID, and the column type is INT, then all rows in the table should be numeric?

    If some rows are null for this field, then you can use:

    UPDATE user_accounts SET password_reset = 1 WHERE user_id IS NOT NULL;

  3. #3

    Join Date
    Apr 2006
    Location
    UK
    Posts
    939
    Thank Post
    39
    Thanked 70 Times in 54 Posts
    Rep Power
    29
    Your correct, just couldn't see further than the end of my nose for a moment or to!

  4. #4
    Arcath's Avatar
    Join Date
    Feb 2009
    Location
    Lancashire
    Posts
    972
    Thank Post
    102
    Thanked 116 Times in 101 Posts
    Rep Power
    74
    you can also leave the WHERE bit off to have it update all records unconditionally

SHARE:
+ Post New Thread

Similar Threads

  1. [Update] Spring Dashboard Update!
    By EduTech in forum Gaming
    Replies: 1
    Last Post: 24th May 2008, 06:35 AM
  2. MySQL
    By nicholab in forum MIS Systems
    Replies: 1
    Last Post: 16th May 2008, 05:29 PM
  3. MYSQL Help
    By danIT in forum General Chat
    Replies: 2
    Last Post: 18th December 2007, 09:52 PM
  4. Microsoft Debuts Update Update Suite
    By mattx in forum General Chat
    Replies: 4
    Last Post: 1st November 2007, 04:07 PM
  5. Update Active Directory with mySQL table data?
    By netadmin in forum Windows
    Replies: 8
    Last Post: 30th October 2007, 10:43 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •