SQL Statement Problem

  • Thread starter Thread starter Atley
  • Start date Start date
A

Atley

Sorry for the wide posting, but i really need some help and I posted
somethind a few hours ago and have heard nothing, so i thought that I would
try reacing more developers...

I am trying to get a date range from the first of whatever month is previous
to the current one to exactly one year previous to that date ie 02/01/04 to
02/01/03 to pull the appropriate section of data out...

I have tried to use:

BETWEEN MONTH(GETDATE()) - 1 + '/' + 01 + '/' + YEAR(GETDATE()) -1 AND
MONTH(GETDATE()) - 1 + '/' + 01 + '/' + YEAR(GETDATE())

But I get a Can't Convert to type INT even if i run this in a query as it's
own result...

I can't seem to find in the documentation what I am doing wrong... I am sure
that it is something simple.

Any help is appreciated.
 
DATEADD(DAY, - DAY(GETDATE()) + 1, DATEADD(MONTH, -1, DATEADD(YEAR, -1,
GETDATE()))) AND

DATEADD(DAY, - DAY(GETDATE()) + 1, DATEADD(MONTH, -1, GETDATE()))
 
* "Atley said:
Sorry for the wide posting, but i really need some help and I posted
somethind a few hours ago and have heard nothing, so i thought that I would
try reacing more developers...

"Some hours ago"? Give people some more time (at least 3 days).
 
Back
Top