April 2, 2012 at 11:53 pm
How to Create a stored procedure to find the following output.
[Q1 = Jan + Feb + Mar ][ Q3 = July + Aug + Sept]
I need to calculate the Q1 = Jan + Feb + Mar(2011) and Q3 = July + Aug + Sept
2011/Q1 2011/Q3
Last Year This Year Last Year This Year
Emp1 Salary
Emp2 Salary
... … … … …
Emp n Salary
Total ∑ ∑ ∑ ∑
I need to calculate the Salary of employee i.e [Q1 = Jan + Feb + Mar ] and [Q3 = July + Aug + Sept] of 2011
Thanks
April 3, 2012 at 1:30 am
suresh0534 (4/2/2012)
How to Create a stored procedure to find the following output.[Q1 = Jan + Feb + Mar ][ Q3 = July + Aug + Sept]
I need to calculate the Q1 = Jan + Feb + Mar(2011) and Q3 = July + Aug + Sept
2011/Q1 2011/Q3
Last Year This Year Last Year This Year
Emp1 Salary
Emp2 Salary
... … … … …
Emp n Salary
Total ? ? ? ?
I need to calculate the Salary of employee i.e [Q1 = Jan + Feb + Mar ] and [Q3 = July + Aug + Sept] of 2011
Thanks
Hello and welcome to SSC!
I'd like to be able to help, but it seems you've forgot to post readily consumable sample data and ddl scripts.
If you could read this article[/url] about the best way to post DDL and sample data then edit your post to include it, it would be extremely useful for the unpaid volunteers of this site.
Thanks!
April 3, 2012 at 3:30 am
I posted a solution on a similar topic quite recently here:
http://www.sqlservercentral.com/Forums/Topic1273926-392-2.aspx
Perhaps this will help you, perhaps not. Depends on your incoming data format and exactly how you need your expected results organized.
As Cadavre suggests, posting DDL and some readily consumable sample data will no doubt deliver a high quality solution to your question in a very short span of time.
Hope this helps.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply