April 3, 2015 at 4:44 am
I have the table like the following
EmployeeIDEmployeeNameBasic HRA ProcessingMonthProcessingYear
101 AAA 15000 6000 Jan 2015
101 AAA 15000 6000 Feb 2015
102 BBB 12000 5000 Jan 2015
102 BBB 15000 6000 Feb 2015
I want the result like
Jan Feb
Basic 27000 30000
HRA 11000 12000
April 3, 2015 at 6:29 am
Take a look at Pivot.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 3, 2015 at 7:45 am
Or take a look at the two links in my signature about cross tabs. This is another way to do the same thing.
_______________________________________________________________
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/
April 5, 2015 at 11:05 pm
Thanks for your reply. I got it.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply