Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
eganopat
Starting Member
1 Post |
Posted - 2015-03-06 : 09:06:55
|
Hi,I am having a problem transforming a data set to the structure I need. Any suggestions of how to go about this would be great.I have data in the following format.Id Visit1 Visit2 Visit3 Visit4 1 2Mar2010 27Mar2010 24Apr2010 8Jul2010 2 2Apr2010 3May2010 4Jun2010 11Jul2010I need to transform it into a table which gives a count of the number of subjects at each visit at the end of each month.For example, in March there will be 1 subject at visit 2. In April, there will be a total of 2 subjects, 1 at visit 1 and 1 at visit 3. In May there will be 2 subjects, 1 at visit 3 and 1 at visit 2, etc.Thanks for looking at this.Hi,Here is the table I was hoping to produce.Date.....Subjects.......Visit1.....Visit2.....Visit3.....Visit4March....1.............................1 April......2...................1.........................1May.......2.............................1..............1Jun.......2............................................2Jul.......2...........................................................2Thanks. |
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-03-06 : 13:41:55
|
can you post of your expected output?------------------------PS - Sorry my bad english |
|
|
|
|
|