Hello Everybody,
I have used inner join with two tables to join them and tried to calculate the sum of rows. Now the table descriptions are-
Table1- agent_business_collection
(it stores business collection of an agent of different business packages)
Table2 - agent_business_commission
(it stores commission of an agent against different business packages)
Now, I want to calculate total business collection and commission for a particular agent. I am using the following query to do the task.
select agent_business_collection.agent_code,agent_business_collection.business_pkg_ref,sum(agent_business_collection.self_amount),sum(agent_business_commission.self_comm_amt) from agent_business_collection inner join agent_business_commission on agent_business_collection.business_pkg_ref=agent_business_commission.business_pkg_ref where agent_business_collection.agent_code='100004' group by agent_business_collection.agent_code,agent_business_collection.business_pkg_ref
But after executing, it returns garbage total. What I am missing and what wrong I have did? Please help me.