在sqlite中减去值

时间:2016-02-17 19:17:30

标签: sqlite subtraction

我想在同一个表中减去两列两个值的值。 EJ:

select DOMAINID, sum(MAXIMO), sum(MINIMO)
from TU_MEMORIA_SERVIDOR_HIS;

APLICACION|SUM(MAX) |SUM (MIN)
APLICACION|177862176|175412792

这样输出如下所示:

APLICACION|SUM(MAX) |SUM(MAX)-SUM(MIN)
APLICACION|177862176|2449384

谢谢!

1 个答案:

答案 0 :(得分:2)

你会做你写的:SUM(maximo) - SUM(minimo)

SELECT SUM(maximo), SUM(maximo) - SUM(minimo)
FROM tu_memoria_servidor_his;

Here it is in SQL Fiddle