473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Stringing together a CASE expression

1
I am converting some MS Access queries into sharepointe reporting services and I'm stuck.

I have a query in access that basically says:
Expand|Select|Wrap|Line Numbers
  1. IIF ([column1] = true, 'yes1, ') & IIF ([column2] = true, 'yes2, ') as Results
  2.  
Below are the results I would get.
Expand|Select|Wrap|Line Numbers
  1. UserID   Results
  2. User1    Yes1, 
  3. User2    Yes1, Yes2, 
  4. User3    Yes2, 
  5. User4    
  6. etc...
  7.  
Trying to translate that over to SQL is where I'm stuck. I thought about something like:
Expand|Select|Wrap|Line Numbers
  1. CASE WHEN column1 = true THEN 'yes1, ' + CASE WHEN column2 = true THEN 'yes2, ' ELSE 'no' END AS Results
  2.  
That isn't working. It appears that if the first criteria is met it uses it and then adds the else result to the end of it.
Expand|Select|Wrap|Line Numbers
  1. UserID   Results
  2. User1    yes1, no
  3. User2    yes1, no
  4. User3    
  5. User4    
  6.  
Is there something other then CASE that I should be using? Basically I want to evaluate multiple true/false fields and show all trues in one column separated by commas.
Aug 29 '08 #1
0 1203

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob Kopp | last post by:
I have a query that I need a hand on. I am trying to add togther some fiends based on values of another. What I would like to add a billing total by saying more or less the following: SELECT...
15
by: Stormkid | last post by:
Hey Gang, I'm trying to figure out the best way to add two times together of the format hh:mm:ss any suggestions would be great thanks Todd
6
by: deanfamily11 | last post by:
I've set up a case statement to have my program determine where on the Cartesian plane a point the user enters is located. I keep getting the C2051 error when I compile. Any help? #include...
6
by: Antanas | last post by:
How can I make Case expression not to execute ADDID() when it does not satisfy requirements? Right now it executes function even if requirments are not met. SELECT ADDID(), CASE WHEN 'A' IS...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
1
by: jelling | last post by:
Hi, Is it possible to use a CASE or IF ELSE statement in a datacolumn expression? Here's what I've tried: 'standardCodeColumn.Expression = "CASE StandardsBodyID WHEN 1 THEN 'JCAHO' ELSE...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.