Get last month from timestamp

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2008
Posts: 339
Reputation: freshfitz is an unknown quantity at this point 
Solved Threads: 27
freshfitz freshfitz is offline Offline
Posting Whiz

Get last month from timestamp

 
0
  #1
Jan 1st, 2009
How would I select everything from last month in a sql statment my cell has a time stamp in it

  1. SELECT DateTimeStamp
  2. 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
Last edited by freshfitz; Jan 1st, 2009 at 3:50 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Get last month from timestamp

 
0
  #2
Jan 1st, 2009
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?
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 339
Reputation: freshfitz is an unknown quantity at this point 
Solved Threads: 27
freshfitz freshfitz is offline Offline
Posting Whiz

Re: Get last month from timestamp

 
0
  #3
Jan 1st, 2009
I want to display all the orders from last month so

  1. SELECT *
  2. FROM Get_estimates
  3. WHERE DateTimeStamp = [lastmonth]
Last edited by peter_budo; Jan 6th, 2009 at 9:21 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Get last month from timestamp

 
0
  #4
Jan 1st, 2009
Ok, please give me sample Data and your desired output
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 339
Reputation: freshfitz is an unknown quantity at this point 
Solved Threads: 27
freshfitz freshfitz is offline Offline
Posting Whiz

Re: Get last month from timestamp

 
0
  #5
Jan 1st, 2009
I got it thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC