Solved

Case Statement

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

11 Experts available now in Live!

Get 1:1 Help Now