943,769 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Marked Solved
  • Views: 5053
  • MS SQL RSS
Jan 1st, 2009
0

Get last month from timestamp

Expand Post »
How would I select everything from last month in a sql statment my cell has a time stamp in it

MS SQL Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 12
Solved Threads: 36
Posting Pro in Training
freshfitz is offline Offline
436 posts
since Sep 2008
Jan 1st, 2009
0

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?
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 1st, 2009
0

Re: Get last month from timestamp

I want to display all the orders from last month so

sql Syntax (Toggle Plain Text)
  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.
Reputation Points: 12
Solved Threads: 36
Posting Pro in Training
freshfitz is offline Offline
436 posts
since Sep 2008
Jan 1st, 2009
0

Re: Get last month from timestamp

Ok, please give me sample Data and your desired output
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Jan 1st, 2009
0

Re: Get last month from timestamp

I got it thanks
Reputation Points: 12
Solved Threads: 36
Posting Pro in Training
freshfitz is offline Offline
436 posts
since Sep 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Crazy CrossTab problems
Next Thread in MS SQL Forum Timeline: SQL Server 2005 - Merge Replication





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC