Hi is there some way that output can have different aliases for the THEN or ELSE of the CASE?
SELECT
CASE WHEN prg.program_name LIKE '%Family Emergency%'
THEN l2prg.registration_number[COLOR=#0000cd] as [/COLOR][COLOR=#0000CD]'Registrant Number[/COLOR]'
ELSE l2prg.registration_number[COLOR=#0000cd] as 'P[/COLOR][COLOR=#0000CD]rogram Number' [/COLOR]
END
This does not work and I have tried various bracketing that did not work. It is not a huge deal if this can’t be done because it easy enough to do this programatically but it would be nice to know if there is some way to do this?
you’re on the right track but barking up the wrong tree
offtopic: anyone familiar with the classic book “Go Dog Go”?
what you want is something like this –
SELECT l2prg.registration_number
, CASE WHEN prg.program_name LIKE '%Family Emergency%'
THEN 'Registrant Number'
ELSE 'Program Number'
END AS number_type
although in my experience a yellow flag should go up whenever the same column sometimes means one thing and sometimes another
That is a fantastic book that my kids loved when they were little!
[/INDENT]
Yes that divergent thinking thing coming into play again. Thank you.
The customer for this application has a primary program that they want to display and input in separate fields than the other programs they have; although All these programs have a unique registrant number, program name and registration date.
If I was to break this into separate tables then I would have a complete duplicate structure to the programs table. Does it make sense to break these apart or does this way of doing things - in this case - make sense?