mysql - How can i perform the arithmetic operation in SQL? -




now want perform arithmetic operation through query.
so, need output (points[1]+points[2]+points[4]-points[3] = result).
example: 50+50+50-150 = 0 points.

so how possible via sql query.

+-------------+-----+ | points_type | sum | +-------------+-----+ |           1 |  50 | |           2 |  50 | |           3 | 150 | |           4 |  50 | +-------------+-----+ 

you

select sum(sum) - 2 * (select sum tablename points_type = 3) tablename

where tablename name of table





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -