Scott Marcus
marcus at tsstech.com
Wed Jul 28 11:32:27 CDT 2004
Mark, Any possibility on sending that table to me? If so, zip it up. Scott -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mark A Matte Sent: Wednesday, July 28, 2004 12:11 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Query giving different results each time wow...ok...I still don't understand why I would get different results from the same sql...but I'm ok with that for now... Scott, the sql below and the 2 query approach did give different results(about 300 difference). The sql below did give the number I expected...but as Patricia pointed out...it did not always give the max of the date...although it provided the correct number of records...they were not always the correct ones...So I tried to change the 'last' on the effdt to 'max'...but the results do vary...I get the last phone number...but the max date...with this approach the date and phone don't necessarily correspond anymore. So close...I can feel it. Thanks, Mark >From: "Scott Marcus" <marcus at tsstech.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: "Access Developers discussion and problem >solving"<accessd at databaseadvisors.com> >Subject: RE: [AccessD] Query giving different results each time >Date: Wed, 28 Jul 2004 11:34:41 -0400 > >Ok. I'll be more careful... > >SELECT tblTest.bo_id, > Last(tblTest.pro_cm_seq) AS SEQ, > Last(tblTest.Phone) AS PHONE_NUMBER, > Last(tblTest.effdt) AS EFFECTIVE_DATE >FROM tblTest >GROUP BY tblTest.bo_id, tblTest.Primary >HAVING (((tblTest.Primary)=True)) >ORDER BY tblTest.bo_id, Last(tblTest.effdt); > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of O'Connor, >Patricia (OTDA) >Sent: Wednesday, July 28, 2004 11:29 AM >To: Access Developers discussion and problem solving >Subject: RE: [AccessD] Query giving different results each time > > >Be Careful using LAST it will not always give you what you expect. It >will give you the last one it encounters which may not be the MAX date >!!! > >See help files and knowledge base > >Patti > >-- >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ Overwhelmed by debt? Find out how to 'Dig Yourself Out of Debt' from MSN Money. http://special.msn.com/money/0407debt.armx -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com