select
dbo.fnFormatFullName(i.Ind_GUID, 'tblindividual')as [Member Name],
ISNULL(dbo.fnFormatFullName(ii.Ind_GUIDTo, 'tblindividual'),
RTRIM( ft.famt_surname) + ',' + rtrim(ft.FamT_FirstName) + ISNULL(' '
+ FamT_MiddleName,
''))as [Parent's Name] ,
ISNULL(ii.Relat_Code, ift.Relat_Code)as [Relationship to Member]
FROM dbo.tblIndividual i WITH ( NOLOCK )
LEFT JOIN dbo.tblIndividualIndividual ii WITH ( NOLOCK ) ON i.ind_guid = ii.Ind_GUIDFrom
AND ii.Relat_Code IN (
'MO','FA' )
LEFT JOIN dbo.tblcase c WITH ( NOLOCK ) ON c.case_guid = i.case_guid
LEFT JOIN dbo.tblIndividualFamilyTree ift WITH ( NOLOCK ) ON i.ind_guid = ift.ind_guid
AND ift.Relat_Code IN (
'MO', 'FA' )
LEFT JOIN dbo.tblFamilyTree ft WITH ( NOLOCK ) ON ft.FamT_GUID = ift.FamT_GUID
How can I have MO(Mother Name) and FA(Father Name) in different columns??
Thank you,
Erdal Huzmeli