June 29, 2015 at 12:37 pm
Hi
I have a records with fields named question1 thru question10
for example if I query select * from mytable with startdate > 1/1/2010
I may get
StartDate Question1 Question2 Question3....
1/1/2010 yes no no
1/2/2010 no no no
what I would like is a filed which would concatenate the fields with the value "no"
similar to
1/1/2010 yes no no Question2,Question3
1/2/2010 no no no Question1,Question2,Question3
Thanks
June 29, 2015 at 12:45 pm
Actually I just tried
case when (Question1 = N'No') then 'text here ' else '' end
+ case when (Question2 = N'No') then 'text here ' else '' end
+ case when (Question3 = N'No') then 'text here ' else '' end as result
It works, but maybe something better ?
June 29, 2015 at 12:50 pm
jbalbo (6/29/2015)
Actually I just triedcase when (Question1 = N'No') then 'text here ' else '' end
+ case when (Question2 = N'No') then 'text here ' else '' end
+ case when (Question3 = N'No') then 'text here ' else '' end as result
It works, but maybe something better ?
If this works for you then use it. I don't think there's a much better way to do it.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply