Solved

Case Statement

Posted on 2011-03-25
1
210 Views
Last Modified: 2012-05-11
use Nas 
Select	datename(mm,Application_Date) as ApplicationMonth,
		year(Application_Date) as ApplicationYear,
		A.Application_ID,
		--Case When ApplicationApplicant.Applicant_ID  'is null' then 'Indv' else 'joint' end as 'AppInd'
		
		
		ApplicationApplicant.Applicant_ID
		--ApplicantCompany.Applicant_ID
		
		
from	dbo.Application A
		left join ApplicationApplicant on ApplicationApplicant.Application_ID = A.Application_ID
		left join ApplicantCompany on ApplicantCompany.Application_ID = A.Application_ID
		left join Applicant on Applicant.Applicant_ID = ApplicationApplicant.Applicant_ID
		left join Applicant Ap on Ap.Applicant_ID = ApplicantCompany.Applicant_ID
where	Application_Date Between '2010-12-01 00:00:00' and '2010-12-31 23:59:59'
 order by 3

Open in new window


Hi I am trying to point a case statement in that creates a new column that will show the name 'jnt'
in the 'ApplicationApplicant.Applicant_ID' column shows Null  and show 'Ind' if i has a number in the 'ApplicationApplicant.Applicant_ID'  column
Test-Data-Jnt-Bond.xls
0
Comment
Question by:Davesm
1 Comment
 
LVL 5

Accepted Solution

by:
soujanya_g earned 500 total points
ID: 35214086
Hi

You are checking Is Null in single quotes as 'is null' but you have to check as   "ApplicationApplicant.Applicant_ID  Is Null"




 
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

12 Experts available now in Live!

Get 1:1 Help Now