No. Because the WHERE condition would control both: SUM(lcreceive.amount_us) SUM(lcopen.unit_price_us*lcopen.order_cbm) * 7.8
--- Christensen, Dave <[EMAIL PROTECTED]> wrote: > SELECT SUM(lcreceive.amount_us), > FROM lcopen, lcreceive > WHERE lcreceive.due_date < current_date > AND lcopen.id=lcreceive.id GROUP BY lcopen.bank; > > > Like this? > -----Original Message----- > From: Terence Ng [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 03, 2003 7:09 PM > To: mysql > Subject: RE: Question - SELECT > > > Thanks for your help, but I just want > /* this condition */ lcreceive.due_date < > current_date > /* affect to */ SUM(lcreceive.amount_us) > /* and not */ > > > 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 _______________________________________________________________________ Do You Yahoo!? Get your free @yahoo.com.hk address at http://mail.english.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