Hi, all
how to get a sum of two field in different table.?
please help.
Get sum fuction?[SOLVE]
Moderator: General Moderators
Get sum fuction?[SOLVE]
Last edited by jayson.ph on Mon Jul 02, 2012 2:48 am, edited 1 time in total.
Re: Get sum fuction?
A JOIN to bridge the tables and simple addition for the sum.
Re: Get sum fuction?
ah can i have a syntax...


Re: Get sum fuction?
Considering how easy it is to find out how to write a JOIN, no.
Re: Get sum fuction?
i trying this: but why all i receive get all total. please help
Code: Select all
SELECT tbl_recieve.id,
tbl_recieve.uid,
tbl_recieve.cat_name,
tbl_recieve.product_name,
tbl_recieve.product_model,
tbl_recieve.rec_on,
tbl_recieve.return_on,
tbl_recieve.sold,
sum(tbl_recieve.balancs)as Balance FROM tbl_recieve INNER JOIN tbl_adm_rpl ON tbl_recieve.id = 'id' group by tbl_recieve.balancs order by Balance,
tbl_recieve.re_qty,
tbl_recieve.dt_nwo,
tbl_recieve.dt_response,
tbl_recieve.commnt,
tbl_recieve.dt_recve,
tbl_user.uid,
tbl_user.tbl_brnch_name,
tbl_user.f_name
FROM tbl_recieve INNER JOIN tbl_user ON tbl_recieve.uid = tbl_user.uid WHERE tbl_recieve.uid = '$_SESSION[SESS_MEMBER_ID]'";