SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How change multiple Mysql fields?

    Hi i have a table with 2,733 records.

    I need to change a field (published) on all records to show '1' instead of the current 'NULL'

    How can i change multiple fields at once?

    Thanks in advance for any help with this issue.

  2. #2
    SitePoint Guru MikeBigg's Avatar
    Join Date
    Jun 2004
    Location
    Reading, UK
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just as a where clause in a select statement allows you to select certain rows, so it does with an update statement:

    select * from mytable where mycolumn is null

    will list all the rows with null in the column.

    update mytable set mycolumn = 1 where mycolum is null

    will update all the rows with null on the column

    hth

    Mike

  3. #3
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Brilliant Mike, worked perfect, thanks for your help!


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
  •