June 20, 2012 at 10:01 am
THE FINAL table should look like this. I have temp table A and I have two fields FYPer/yr, and MS_DRG fields. MS_DRG has two values 765 and 765. I want their count by FYPer/YR
FYPer/Yr 765766
4/2012 4041
5/2012 3853
I do not know the use of PIVOT, I need help.
This is what I have written so far.
Thanks in advance.
June 20, 2012 at 10:05 am
The path to your answer starts by reading the first link in my signature.
In other words we need ddl, sample data and desired output. You did not post near enough information for anybody to have a chance at helping you.
_______________________________________________________________
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/
June 20, 2012 at 10:09 am
Let's keep everything in one place:
hbanerje (6/20/2012)
Sorry I forgot to paste the code in the previous email.Select
COUNT (MS_DRG) as 'cntof MS_DRG',ms_drg, FYFP,
MS_DRG as '765',
MS_DRG as '766',
FYFP
from #TSI_patient_list_Csections
group by FYFP,ms_DRG
I need the table to look like this ...
FYPer/Yr 765766
4/2012 4041
5/2012 3853
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply