[AccessD] Re: DatePart Question

Robert L. Stewart rl_stewart at highstream.net
Fri Jan 30 23:39:52 CST 2004


Gina,

What are you going to do when the year changes and you have data for 2 
January's in 2 years?  The year has to be part of what you us in the 
query.  Try using the date dimension table technique I have been talking 
about and it will smooth things out for you and dates (well dates in the 
database anyway ;-))  ).

Robert

At 02:27 PM 1/30/2004 -0600, you wrote:
>From: Gina Hoopes <hoopesg at hotmail.com>
>To: AccessD at databaseadvisors.com <AccessD at databaseadvisors.com>
>Date: Friday, January 30, 2004 1:26 PM
>Subject: [AccessD] DatePart Question
>
>
>This may be a dumb question, but here goes.  I have a table full of data
>that I need to query, and what I need returned is the data from last month.
>If I query the Max on DatePart("m",PeriodEnd) on the data that's there now,
>I get a 12 which is correct (from 12/31/03).  But, next month we will have
>added January '04 data, so the latest data in the PeriodEnd field will be
>1/31/04, but when I query for just the month, am I going to get a 1?  I
>guess I'm asking if the Max function is still going to look at the whole
>date and return just the DatePart of "m", or will 12 be considered alone,
>and therefore greater than 1?
>
>I'm always open to an easier method, if you've got any ideas.
>
>Thanks,
>Gina




More information about the AccessD mailing list