Thanks for your help, but I just want /* this condition */ lcreceive.due_date < current_date /* affect to */ SUM(lcreceive.amount_us) /* and not */ SUM(lcopen.unit_price_us*lcopen.order_cbm) * 7.8 AS open
Terence --- "Christensen, Dave" <[EMAIL PROTECTED]> 秎ンず甧> SELECT lcopen.bank, > SUM(lcopen.unit_price_us*lcopen.order_cbm) * 7.8 > AS open, > SUM(lcreceive.amount_us), > lcreceive.due_date as receive, > FROM lcopen, lcreceive > WHERE lcreceive.due_date < current_date > AND lcopen.id=lcreceive.id GROUP BY lcopen.bank; > > > I think this will work better. > > Dave > -----Original Message----- > From: Terence Ng [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 03, 2003 9:52 AM > To: mysql > Subject: Question - SELECT > > > How do I correct this SQL code: > > 2 tables there, and I want to add one conditon to > item "receive" lcopen : > id, bank, unit_price_us, order_cbm > lcreceive: id, amount_us, due_date > > SELECT > lcopen.bank, > SUM(lcopen.unit_price_us*lcopen.order_cbm) * 7.8 AS > open, > # > SUM(lcreceive.amount_us) where lcreceive.due_date < > current_date AS receive, > # # the above statement is not correct for the # > additional condition # FROM > lcopen, lcreceive AND lcopen.id=lcreceive.id GROUP > BY lcopen.bank; > > Terence Ng > > > _________________________________________________________ > Lonely > Christmas(?奕迅),風箏與風(Twins),無間道(?影)... > 至In手機?? 陪你過冬天 > http://ringtone.yahoo.com.hk > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list > archive) > > To request this thread, e-mail > <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php _________________________________________________________ Lonely Christmas(朝ǔ)哄籔(Twins)礚丁笵(筿紇)... Inも诀筧羘 抄筁ぱ http://ringtone.yahoo.com.hk --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php