DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   MS SQL (http://www.daniweb.com/forums/forum127.html)
-   -   Get last month from timestamp (http://www.daniweb.com/forums/thread165477.html)

freshfitz Jan 1st, 2009 3:50 pm
Get last month from timestamp
 
How would I select everything from last month in a sql statment my cell has a time stamp in it

SELECT DateTimeStamp
from Get_estimates

Ouput

[DateTimeStamp]
2008-02-28 11:39:35.247
2008-03-09 13:15:12.513
2008-03-09 13:16:53.700
2008-03-26 13:30:20.077
2008-03-26 13:30:51.810

Ramy Mahrous Jan 1st, 2009 3:55 pm
Re: Get last month from timestamp
 
So the output should be
2008-03-09 13:15:12.513
2008-03-09 13:16:53.700
2008-03-26 13:30:20.077
2008-03-26 13:30:51.810

right?

freshfitz Jan 1st, 2009 4:05 pm
Re: Get last month from timestamp
 
I want to display all the orders from last month so

SELECT *
from Get_estimates
where DateTimeStamp = [lastmonth]

Ramy Mahrous Jan 1st, 2009 4:48 pm
Re: Get last month from timestamp
 
Ok, please give me sample Data and your desired output

freshfitz Jan 1st, 2009 5:56 pm
Re: Get last month from timestamp
 
I got it thanks


All times are GMT -4. The time now is 9:01 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC