PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Nov 21, 2014 3:22 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Get sum fuction?[SOLVE]
PostPosted: Sun Jul 01, 2012 11:06 pm 
Offline
Forum Contributor
User avatar

Joined: Mon Jan 02, 2012 10:20 am
Posts: 165
Location: MP
Hi, all

how to get a sum of two field in different table.?

please help.


Last edited by jayson.ph on Mon Jul 02, 2012 2:48 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Get sum fuction?
PostPosted: Sun Jul 01, 2012 11:36 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 5644
Location: WA, USA
A JOIN to bridge the tables and simple addition for the sum.


Top
 Profile  
 
 Post subject: Re: Get sum fuction?
PostPosted: Mon Jul 02, 2012 12:03 am 
Offline
Forum Contributor
User avatar

Joined: Mon Jan 02, 2012 10:20 am
Posts: 165
Location: MP
ah can i have a syntax...

Image


Top
 Profile  
 
 Post subject: Re: Get sum fuction?
PostPosted: Mon Jul 02, 2012 12:30 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 5644
Location: WA, USA
Considering how easy it is to find out how to write a JOIN, no.


Top
 Profile  
 
 Post subject: Re: Get sum fuction?
PostPosted: Mon Jul 02, 2012 1:50 am 
Offline
Forum Contributor
User avatar

Joined: Mon Jan 02, 2012 10:20 am
Posts: 165
Location: MP
i trying this: but why all i receive get all total. please help
Syntax: [ Download ] [ Hide ]
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]'";


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group