Reply to Re: Last Day Of Previous Month...with a twist

Your name:

Reply:


Posted by Chris.Cheney on 05/10/07 13:28

"Plamen Ratchev" <Plamen@SQLStudio.com> wrote in news:BjE0i.8597$Ut6.2872
@newsread1.news.pas.earthlink.net:

> Here is an alternative to Dan's method, just using only the datetime
> functions:
>
> WHERE
> SoldDate >= DATEADD(year, -1, DATEADD(month, DATEDIFF(month, 0,
> CURRENT_TIMESTAMP), 0))
> AND
> SoldDate < DATEADD(month, DATEDIFF(month, 0, CURRENT_TIMESTAMP), 0)
>
> HTH,
>
> Plamen Ratchev
> http://www.SQLStudio.com
>

Is it rash to assume that CURRENT_TIMESTAMP will not be called twice for
each row? Perhaps only twice for the whole query? If it is called more than
once (as implied by the query), there will be a problem if the query is run
at a time such that midnight on the last day of the month occurs between
two calls. Or have I missed something (which I admit is likely).

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация