如何检索此图片中的数据:
我的数据库看起来像这样
SELECT trans_id, badge_id, user_id, comp_id, amount, cash, subsidy, trans_date
FROM trans_details
答案 0 :(得分:0)
详细查询:
select user_id,count(1) as Txn,sum(amount),sum(cash),sum(subsidy)
from trans_details group by user_id;
总计查询:
select count(1) as Txn,sum(amount),sum(cash),sum(subsidy)
from trans_details;