December 16, 2013 at 10:44 am
How to
Extract the data based on the present quarter and last quarter in SQL
Please let me know
Regards,
Praveen
December 16, 2013 at 10:55 am
There's not enough information to help you.
Please post DDL, sample data and expected results as explained on the article linked in my signature.
We're willing to help but we can't see what you see.
December 17, 2013 at 6:10 am
You're going to need to use the DATEPART function to determine the quarter for the date on which you're basing the distribution. http://msdn.microsoft.com/en-us/library/ms174420%28v=sql.100%29.aspx. Other than that, Luis is right - we don't know anything about your table structure or what you're trying to do. Please post DDL, DML to populate sample data and what you've tried so far.
December 17, 2013 at 7:24 am
Here are some excellent ways to get a number of different datetime values. http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/[/url]
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 17, 2013 at 1:36 pm
Smash125 (12/16/2013)
How toExtract the data based on the present quarter and last quarter in SQL
Please let me know
Regards,
Praveen
SELECT TheData
FROM dbo.SomeTable
WHERE SomeDateColumn >= DATEADD(qq,DATEDIFF(qq,0,GETDATE())-1,0)
;
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply