select sum(item_real) from budgetcontrol where department=fi and rownum<=6;
在sql 的sum函数中完成,类似: sum(select sum(item_real) from budgetcontrol where department=fi and rownum<=6;)
--oracle中不支持mysql中的limit分页,你可以使用rownum试试: select sum(item_real) from ( select item_real,rownum as rn from budgetcontrol department=fi ) where rn>0 and rn<6;
select sum(item_real)
from budgetcontrol
where department=fi and
rownum<=6;
sum(select sum(item_real)
from budgetcontrol
where department=fi and
rownum<=6;)
--oracle中不支持mysql中的limit分页,你可以使用rownum试试:
select sum(item_real)
from (
select item_real,rownum as rn
from budgetcontrol
department=fi
)
where rn>0 and rn<6;
如果是oracle,按2楼的写法就没错