SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Oznob's Avatar
    Join Date
    Jun 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL statement help

    How does the SQL statement look for this:

    I have a table called USERS and in it fields called FIELD1, FIELD2, FIELD3

    I want to change all values in FIELD2 that are currently set at 1 to the value 2.


    Simple - but beyond me -- thanks in advance,
    Oznob

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    UPDATE users SET field2=2 WHERE field2=1
    I'm using lowercase for field and tablenames. I recommend the same thing. But uppercase them if you wish.

    Aaron
    Aaron Brazell
    Technosailor




Bookmarks

Posting Permissions

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