i have three tables 1. member_commission 2. member_payment 3. member_detail
now i want to join all three tables to get common deatil..my query is..
select r.ref_id,sum(r.ref_com),m.mname,p.bal_amt from member_commission as r inner join member_detail as m
on r.ref_id=m.mem_id inner join member_payment as p on r.ref_id=p.mem_id where r.pay_check='unpaid' group by r.ref_id
to get total commission earn by all different members,their id and their name and finally last unpaid balance
the details are coming from all these three tables but my query is not working,
there are some error on mname
please give me some exactly idea how to fetch details from three tables ...