I now want to query the three indicators a, b, and c in the database, and verify whether the formula (a b) / 2 = c holds. what should I do? I can only query a, b and c now
select
a,
b,
c
from
table_test
where
type = 1
and
origin not in (10, 20)
CodePudding user response:
Add the assertion in the WHERE
clause:
SELECT a, b, c, IF((a b) / 2 = c, 'True', 'False') AS result
FROM table_test
WHERE type = 1 AND origin NOT IN (10, 20) AND
(a b) / 2 = c; -- added condition here