The following describes how to sum Multiple SQL fields and use them as SQL query conditions for your reference. I hope to help you learn SQL query.
Make a small SQL query for field summation and query the results in a table where the sum of Field 1, Field 2, and field 3 is greater than 0. Therefore, write the following SQL statement.
Note that the Where clause cannot contain fields obtained after self-calculation.
Sqlstr = "select w. ID, W. weather, greenColor, (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID) AS AllValue FROM Weather w where (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID)> 0 order by id ";
That is, the following SQL statement does not work, saying "at least one parameter is not specified ".
Sqlstr = "select w. ID, W. weather, greenColor, (SELECT redColor + greenColor + blueColor FROM Weather n where n. ID = W. ID) AS AllValue FROM Weather w where AllValue> 0 order by id ";