php - select by two condition and split by attribute -
how can retrieve data in image:
my database looks this
select trans_id, badge_id, user_id, comp_id, amount, cash, subsidy, trans_date trans_details
for details query:
select user_id,count(1) txn,sum(amount),sum(cash),sum(subsidy) trans_details group user_id;
for totals query:
select count(1) txn,sum(amount),sum(cash),sum(subsidy) trans_details;
Comments
Post a Comment