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
Post a Comment