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]> ���l�e�G> 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(?��Ѹ)���L�~�c�L(Twins)���o�g��(?Ӱ)... > ��In�֙C?? �����^���� > 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(������)�A����P��(Twins)�A�L���D(�q�v)... ��In����a�n ���A�L�V�� 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
