Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with a case statement

Posted on 2009-07-03
3
Medium Priority
?
229 Views
Last Modified: 2012-05-07
I have the following statement:

select user from assets

What I would like to do is have a case statement  where if it's an empty string then I return false, else I return true.

I can't seem to get it rght.

0
Comment
Question by:directxBOB
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1600 total points
ID: 24772009
select [user] , case when [user] = '' then 'false' when [user] IS NULL then 'false' else 'true' from [assets]
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 200 total points
ID: 24772138
i think Angel missed the 'End'

select [user] , case when [user] = '' then 'false' when [user] IS NULL then 'false' else 'true' End as Status
from [assets]
0
 
LVL 14

Assisted Solution

by:shru_0409
shru_0409 earned 200 total points
ID: 24772148
select user , case user when  user then 'TRUE' ELSE 'FALSE' end from assets

try this
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question