[PHP-DB] help me JOIN 3 tables.

2009-01-13 Thread Abah Joseph
I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id The above query works but i want to add the one below SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = e1.loanID; the last part of the query is to SUM the part

Re: [PHP-DB] help me JOIN 3 tables.

2009-01-13 Thread Yves Sucaet
on (l1.entreID = e1.entre_ID) WHERE e1.entre_active = 'Y' hth, Yves - Original Message - From: Abah Joseph joefa...@gmail.com To: php-db@lists.php.net Sent: Tuesday, January 13, 2009 6:46 AM Subject: [PHP-DB] help me JOIN 3 tables. I have this SQL SELECT e1.*, l1.* FROM e1 INNER JOIN

Re: [PHP-DB] help me JOIN 3 tables. - fixed query

2009-01-13 Thread Yves Sucaet
hth, Yves - Original Message - From: Yves Sucaet yves.suc...@usa.net To: php-db@lists.php.net Sent: Tuesday, January 13, 2009 7:49 AM Subject: Re: [PHP-DB] help me JOIN 3 tables. Hi Joseph, With the sum() aggregate function you'll need to use a GROUP BY clause and specify which