dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Error Updating multiple value sets in MySQL

  1. #1
    Join Date
    Jun 2009
    Location
    Cannock
    Posts
    30

    Exclamation Error Updating multiple value sets in MySQL

    I use the following query to update my database. It does not work, giving me a syntax error. Any Ideas?

    UPDATE table
    SET browser = CASE ID
    WHEN '11' THEN 'Google Chrome 2.0'
    WHEN '49' THEN 'Google Chrome 2.0'
    WHEN '52' THEN 'Google Chrome 2.0'
    END, SET os = CASE ID
    WHEN '11' THEN 'Microsoft Windows'
    WHEN '49' THEN 'Microsoft Windows'
    WHEN '52' THEN 'Microsoft Windows'
    END, SET language = CASE ID
    WHEN '11' THEN 'US English 5'
    WHEN '49' THEN 'US English 5'
    WHEN '52' THEN 'US English 5'
    END WHERE ID IN (11,49,52)

    Thanks,

    Ronnie268

  2. #2
    Join Date
    Jun 2009
    Location
    Cannock
    Posts
    30
    Sorry. I had put some ticks in the wrong place. Still doesn't work, though.

    UPDATE table
    SET browser = CASE ID
    WHEN 11 THEN 'Google Chrome 2.0'
    WHEN 49 THEN 'Google Chrome 2.0'
    WHEN 52 THEN 'Google Chrome 2.0'
    END, SET os = CASE ID
    WHEN 11 THEN 'Microsoft Windows'
    WHEN 49 THEN 'Microsoft Windows'
    WHEN 52 THEN 'Microsoft Windows'
    END, SET language = CASE ID
    WHEN 11 THEN 'US English 5'
    WHEN 49 THEN 'US English 5'
    WHEN 52 THEN 'US English 5'
    END WHERE ID IN (11,49,52)

  3. #3
    Join Date
    Jun 2009
    Location
    Cannock
    Posts
    30
    Fixed it now. 'SET' should not have been repeated.

    UPDATE table
    SET browser = CASE ID
    WHEN 11 THEN 'Google Chrome 2.0'
    WHEN 49 THEN 'Google Chrome 2.0'
    WHEN 52 THEN 'Google Chrome 2.0'
    END, os = CASE ID
    WHEN 11 THEN 'Microsoft Windows'
    WHEN 49 THEN 'Microsoft Windows'
    WHEN 52 THEN 'Microsoft Windows'
    END, language = CASE ID
    WHEN 11 THEN 'US English 5'
    WHEN 49 THEN 'US English 5'
    WHEN 52 THEN 'US English 5'
    END WHERE ID IN (11,49,52)

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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



Recent Articles