Solved

sql case statement

Posted on 2013-01-09
1
286 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
ID: 38760649
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GRANT, REVOKE, DENY 4 38
SQL Maintenance Plan 3 30
Pivot not using aggregate yield error 3 42
Sql Query with datetime 3 14
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

862 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

23 Experts available now in Live!

Get 1:1 Help Now