Solved

sql case statement

Posted on 2013-01-09
1
285 Views
Last Modified: 2013-01-09
When the record is found then Found = 'Y' else Found ='N'. How do I do that in the select statement.

SELECT Found='Y'
-- [lien_id]
--      ,[title_app_id]      
  FROM [t21_maryland_dev].[dbo].[title_app_liens] a
  where a.[title_app_id] = 7599
0
Comment
Question by:Meinhoonaa
1 Comment
 
LVL 11

Accepted Solution

by:
Guru Ji earned 500 total points
Comment Utility
SELECT CASE WHEN COUNT(1) > 0 THEN 'Y' ELSE 'N' END AS RecordFoundMessage
FROM [t21_maryland_dev].[dbo].[title_app_liens] a
  where a.[title_app_id] = 7599
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now