forum

Home / DeveloperSection / Forums / SQL - Update multiple cells in one columns with the same ID

SQL - Update multiple cells in one columns with the same ID

Anonymous User219022-Sep-2014

I have a table Answer in SQL Server like this:

QuestionID         AnswerID            AnswerContent                                IsTrue

1                              1                              1990                                       True

1                              2                              300$                                       False

1                              3                              1992                                       True

2                              4                              1993                                       False

2                              5                              400$                                       True

2                              6                              600$                                       False

5                              7                              Lion                                        False

5                              8                              Tiger                                      True

5                              9                              Elephant                              False

 

Because the AnswerID is an auto-increment and I don't know exactly its value when running the query.

So how can I update the AnswerContent column?

Example: I need to update

"Tiger - False" to "Elephant - True"

"Lion - True" to "1992 - False"

 

--- Update ---

 

I cannot change the table structure because it's my teacher's order.


Updated on 28-Apr-2023
I am a content writter !

Can you answer this question?


Answer

2 Answers

Liked By