如何通过空表上的内连接来修复空字段

如何通过空表上的内连接来修复空字段

本文介绍了如何通过空表上的内连接来修复空字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

USE [HRRecruitment]
GO
/****** Object:  StoredProcedure [dbo].[GenerateReport]    Script Date: 04/05/2015 21:30:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[GenerateReport]
(
@StartDate DATE,
 @EndDate DATE,
 @Email nvarchar(40)
 )
as
begin
Declare @start VarChar, @end VarChar

If not exists(select * from tblWorkExpDetails where Email=@Email)
begin
select
pd.FirstName,
pd.LastName,
pd.Mobile,
pd.Email,
pd.Sources,
ed.XthPercentage,
ed.XIIthPercentage,
ed.GPercentage,
ed.PGPercentage,
wed.CurrentSalary,
wed.TotalExperience,
fd.Typing
from
tblPersonalDetails pd
Inner Join tblEducationalDetails ed on pd.Email=ed.Email
Inner Join tblWorkExpDetails wed on pd.Email=wed.Email
Inner Join tblFresherDetails fd on pd.Email=fd.Email
where pd.JoinDate Between @StartDate and @EndDate
end
else if not exists(select * from tblFresherDetails where Email=@Email)
begin
select
pd.FirstName,
pd.LastName,
pd.Mobile,
pd.Email,
pd.Sources,
ed.XthPercentage,
ed.XIIthPercentage,
ed.GPercentage,
ed.PGPercentage,
wed.CurrentSalary,
wed.TotalExperience,
fd.Typing
from
tblPersonalDetails pd
Inner Join tblEducationalDetails ed on pd.Email=ed.Email
Inner Join tblWorkExpDetails wed on pd.Email=wed.Email
Inner Join tblFresherDetails fd on pd.Email=fd.Email
where pd.JoinDate Between @StartDate and @EndDate
end
else
begin
select
pd.FirstName,
pd.LastName,
pd.Mobile,
pd.Email,
pd.Sources,
ed.XthPercentage,
ed.XIIthPercentage,
ed.GPercentage,
ed.PGPercentage,
wed.CurrentSalary,
wed.TotalExperience,
fd.Typing
from
tblPersonalDetails pd
Inner Join tblEducationalDetails ed on pd.Email=ed.Email
Inner Join tblWorkExpDetails wed on pd.Email=wed.Email
Inner Join tblFresherDetails fd on pd.Email=fd.Email
where pd.JoinDate Between @StartDate and @EndDate
end
end;

推荐答案


这篇关于如何通过空表上的内连接来修复空字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 16:01