Solved

Case Statement

Posted on 2011-03-25
1
214 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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…

730 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