Skip to content
Advertisement

How to run a unique function to calculate and replace a null value in a database?

enter image description here

In the above database, I want to calculate the value for “A2” using the other 3 variables. The premise is that each column has a specific score with respect to each variable and the javascript would sum the answers in a row with a null blank in the A2 slot in this case.

Advertisement

Answer

You can implement the same logic in SQL with a couple of case expression:

If you wanted an update statement:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement