I have to create a stored procedure by using 3 tables,1st is Registration table,job seeker table,employment detail table. In that I am having entries in 1st two tables.Till now I am not having any entry in employment detail table.
I am having following query:
select RD.FirstName,RD.LastName,
(select case when JR.profileHeadline=''
then 'No Resume Headline mentioned'
else JR.profileHeadline end
from jobseekerReg JR)as profileHeadline ,
(select case when ED.designation=''
then 'No designation mentioned'
else ED.designation end
from employmentDetail ED)as designation,
(select case when ED.companyName=''
then 'No company name mentioned'
else ED.companyName end
from employmentDetail ED) as companyName,JR.location,
(select case when ED.funcArea=''
then 'No functional area mentioned'
else ED.funcArea end
from employmentDetail ED) as funcArea ,
(select case when ED.cmpIndustry=''
then 'No industry mentioned'
else ED.cmpIndustry end
from employmentDetail ED)as cmpIndustry,RD.BirthDay,
RD.Gender,JR.experience,
(select case when ED.salary=''
then 'No salary mentioned'
else ED.salary end
from employmentDetail ED)as salary ,JR.mobileNumber,JR.emailId,
JR.altEmailID,JR.jobSeekerAddrs,JR.maritalStatus,
(select case when JR.keySkills=''
then 'No keyskills mentioned'
else JR.keySkills end
from jobseekerReg JR)as keySkills
from RegistrationDetails RD join jobseekerReg JR on RD.Reg_Id=JR.regId
left outer join employmentDetail ED on ED.regId=JR.regId
and ED.regId=2 where RD.Reg_Id=JR.regId and RD.Reg_Id=2 and JR.regId=2
The above query gives me correct output,but the problem is as I am not having any entry in employment table for regId=2, columns in this table gives output as null. how should I handle this problem? suggest me any solution Thanks in advance.
IsNull(fieldname, 'default value')to set default data to null fields if that is what you want. Else there could be problem with populating the field with values.