Updating multiple columns in mysql

6854933580_2c8b688306_z

;) table_foobar ( foobar_id, member_id, question_id, answer One, answer Two, answer Three, answer Four ) //Multiple questions for a single foobar Main survey.

The following My SQL statement will update pub_lang column with NULL if purch_price is more than 50.

Hi Site Point members I have been perusing through the solutions for "updating multiple rows with one query", but I have a pressing question: How would one "SET" multiple column values with one query?

Here is my example..normal update command would be: // question ID ranges from 1-20 // $questionid == 1, $member_id==1 UPDATE table_Foo Bar SET answer One='$ans1Val', answer Two='$ans2Val', answer Three='$ans3Val' WHERE member_id='$memberid' AND question_id='$questionid'; // $questionid == 2, $member_id==1 UPDATE table_Foo Bar SET answer One='$ans1Val', answer Two='$ans2Val', answer Three='$ans3Val' WHERE member_id='$memberid' AND question_id='$questionid'; ..

PDF (US Ltr) - 37.9Mb PDF (A4) - 38.0Mb PDF (RPM) - 37.3Mb HTML Download (TGZ) - 10.3Mb HTML Download (Zip) - 10.3Mb HTML Download (RPM) - 8.9Mb Man Pages (TGZ) - 216.7Kb Man Pages (Zip) - 329.5Kb Info (Gzip) - 3.4Mb Info (Zip) - 3.4Mb My SQL Backup and Recovery My SQL Globalization My SQL Information Schema My SQL Installation Guide My SQL and Linux/Unix My SQL and OS X My SQL Partitioning My SQL Performance Schema My SQL Replication Using the My SQL Yum Repository My SQL Restrictions and Limitations Security in My SQL My SQL and Solaris Building My SQL from Source Starting and Stopping My SQL My SQL Tutorial My SQL and Windows My SQL NDB Cluster 7.5 option as part of a table reference.

This option takes a list of one or more partitions or subpartitions (or both).

When i use three seperate UPDATE commands, one for each column, FUNNILY, the first and the third columns get updated, and for some GOD KNOWS WHAT reason, the second column just refuses to change...

You must have an account to comment. Please register or login here!