Forum Discussion
1 data set, 20 odd fixed columns, 9 dynamic columns
Sample table (inserted as picture as it wouldnt let me post as a table here):
Limited by the 10 columns limit here, but effectively columns 1-4 (scheme to specialty) I have 20 odd (that dont change from scheme to scheme), and then I have 9 (3 varchar, 3 dates, 3 ints) that do change scheme to scheme.
So for scheme 1 date_1 refers to the previous attended appointment, date_2 refers to the next/future appointment, and int_1 refers to the weeks between the two appointments. They would be ideally given short hand names such as that. The varchar_1, varchar_2 and int_2 columnsare null for this scheme. This scheme might have say 1000 rows.
Scheme 2 and 5 (say 500 rows each) do not have any data at all in the varchar, date and int columns. Scheme 3 varchar_1 refers to an admission ward code/name, and the date_1 column is the future admission date. Scheme 4 varchar_1 refers to the priority of the appointment, varchar_2 to the fact that its the patients first appointment and date_1 to the referral date from their medical practioner.
Each scheme will have the same varchar, date and int columns completed. Ideally i want to create a summary page that shows counts by scheme and then allow the user to drill down in to a specific scheme (say scheme 1) and see a dataset with the varchar, date and int columns named appropriately as to that scheme, and if possible, the other NULL columns dropped out.
I did have this before as individual named columns but that was creating around 15 columns (with potential for it to increase further if more schemes are added) and I want to try and present as small a table of data as possible to the end user
At this moment in time I am using a direct query to a SQL view so not sure unpivoting works with that but will look in to it a bit more.
Thanks again!
amitchandak Greg_Deckler is the sample data above sufficient? I can expand further if required?
Thanks again