Updating multiple columns

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Sign up to join this community UPDATE some_table SET column_x = CASE WHEN x_specific_condition THEN new_value_for_x ELSE column_x END, column_y = CASE WHEN y_specific_condition THEN new_value_for_y ELSE column_y END, WHERE some_more_conditions Problem with above is, each column (x, y) still gets updated with their own value if some_more_conditions return true irrespective of their specific conditions returning true.The above method will be time consuming and tedious if there are lots of field calculations needed to be changed, here, I can introduce you a code to change multiple filed settings at the same time. Hi everyone, I have a table: create table utente (id_utente number(5) Primary Key, nome varchar2(40), sexo varchar2(1) check (sexo='M' or sexo='F'), morada varchar2(60), data_nascimento date, contacto number(10), numero_BI number(9) ); and I need to update several fields at once. Then in the Value Field Settings dialog box, select one type of calculate which you want to use under the Summarize Value By tab, see screenshot: 3. And then click OK to close this dialog, and you can see your Count function has been changed to Sum function, see screenshot: 4. Example (User enters: 24052)If "Use Alternative" is checked, then use hidden constant [X] to calculate "Value Saved": (24052 - X = 1022) Well, even though I have shown my table structure, if you have a much more logical table structure for this survey, by all means I would love see what you had in mind.

- The database must contain a record of answers made by all users- Every "Item" has 4 answers associated with them, (for now...)- There can be any number of "items" listed on a single survey page (in this screenshot, I only show 3 items, but there may be up to 20 or 30 items that have to be listed)- "Value Saved" has a HIDDEN constant that gets calculated with the "Test Value" entered.you really ought to help make it easier for poeple to try to help you.There are other issues but, I got confused with the table names.UPDATE table_Foo Bar SET answer One='yes', answer Two='no', answer Three='yes' WHERE member_id = 1 AND question_id = 1; UPDATE table_Foo Bar SET answer One='no', answer Two='no', answer Three='yes' WHERE member_id = 1 AND question_id = 2; UPDATE table_Foo Bar SET answer One='yes', answer Two='yes', answer Three='no' WHERE member_id = 1 AND question_id = 3; oh, absolutely!!your problem likely lies in the php code, something about constructing variables and looping (i'm guessing -- i don't do php so i only gave your code a cursory glance) however, since you asked this question in the mysql forum, let me give you a mysql answer redesign your table, normalize it to first normal form you have repeating columns in answer One, answer Two, answer Three these should be three rows in a normalized table from there, the php will be slightly different Hello r937! To address your normalization suggestion, here is my table structure (it goes into a tiny bit more detail; my first example was a very generalized one, this one is also generalized to a certain extent) - and there is a specific reason why I have designed it so...which I will explain in a bit.

Leave a Reply