Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Ingressando no SQL Server 2008


Você deve considerar trabalhar com UNION ao invés de JOIN.

Simplificando sua consulta, a união pode ficar assim
SELECT           dbo.Stu_info.Id_num, dbo.Development_fee.Dvf
FROM             dbo.Stu_info 
LEFT OUTER JOIN  dbo.Tuition_fee ON dbo.Stu_info.Id_num = dbo.Tuition_fee.Id_num 
UNION
SELECT           dbo.Stu_info.Id_num, dbo.Registration_fee.Reg_fee
FROM             dbo.Stu_info 
LEFT OUTER JOIN  dbo.Registration_fee ON dbo.Stu_info.Id_num = dbo.Registration_fee.Id_num