日期:2014-05-17 浏览次数:20865 次
create table INVEST_INFO
(
invest_id NUMBER not null,
loan_id NUMBER not null,
user_id NUMBER not null,
invest_amount NUMBER(22,7) not null,
hava_scale NUMBER(22,18) not null,
invest_time TIMESTAMP(0) not null,
description VARCHAR2(200),
status VARCHAR2(2),
ledger_finance_id NUMBER,
funds_source NUMBER
)
根据user_id和status查询,如果结果里loan_id相同,把invest_amount累加
显示查询后的记录
select user_id,status,loan_id,sum(invest_amount)
from INVEST_INFO
group by user_id,status,loan_id