Here's what I'm trying to accomplish:
I have a query with two columns. The first column can be one of three types (Year, Quarter, Month) and the second column holds the number of business days according to the time period in column one. We are using a program called Siebel Analytics that employs column selectors on the first column, allowing us to change the view from Year to Month and so on.
Enough of the background. I've racked my head to find a dynamic way to see what time period is in the first column and adjust the second column accordingly. Is there some way to grab the field name for column one? If I had my way, the SQL would look something like this:
Is this possible?
Regards,
Randy
Randy
I have a query with two columns. The first column can be one of three types (Year, Quarter, Month) and the second column holds the number of business days according to the time period in column one. We are using a program called Siebel Analytics that employs column selectors on the first column, allowing us to change the view from Year to Month and so on.
Enough of the background. I've racked my head to find a dynamic way to see what time period is in the first column and adjust the second column accordingly. Is there some way to grab the field name for column one? If I had my way, the SQL would look something like this:
Code:
SELECT Time."Year", CASE WHEN [First Column Name] = "Time.'Year'" THEN Time.'Num of Bus Days Year' WHEN [First Column Name] = "Time.'Quarter'" THEN Time.'Num of Bus Days Quarter' ELSE Time.'Num of Bus Days Month' END FROM DWH
Is this possible?
Regards,
Randy
Randy