php - select by two condition and split by attribute -


how can retrieve data in image:

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

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -