0

I want to show data from the last month (not form months past though), this month and any futures data in my report. In a SQL view, how can you do this with the date fields called date?

1
  • 1
    What SQL implementation? Commented Sep 26, 2011 at 18:35

3 Answers 3

2

Alternatively in SQL Server you could use this simple comparison:

…
WHERE DateColumn >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) - 1, 0)
…
Sign up to request clarification or add additional context in comments.

1 Comment

I +1'd from your original comment on my answer. Pretty large logical issue that you addressed.
1

I'm assuming you are using SQL Server, in which case use the DATEDIFF function to see if the date in your table is within the range you want to display.

Information on the function can be found here: http://msdn.microsoft.com/en-us/library/ms189794.aspx

Comments

-1

there is a built in function in SQL Server to add the date .. and for your date field named as date select it as [date]

1 Comment

This isn't really an answer. This is like someone asking how to change the oil in their car and your response is "You just change it".

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.