MySQL Forums
Forum List  »  Newbie

Help with using an "IFF" with "OR"
Posted by: Heath Bohannan
Date: March 10, 2022 10:21AM

Hi group,

I am new to this world, and hope you could help with with the following. I am trying to return a single row where **status = Y and ** status = N
i.e. a client is in both Seg & NonSeg (underlying clients are split within legal entity). Hence my attempt with the row starting --

currently, if they have both then the output is on two separate rows

select eg.legalEntityId,le.name

,iif(eg.segregationStatus='S' ,'Y','') Seg

--,iif((eg.segregationStatus='S' and eg.segregationStatus='N','Y') or iff(eg.segregationStatus='S', 'Y') ,'') Seg

,iif(eg.segregationStatus='N','Y','') Non_Seg

from Account.Account a
join EquityGroup.EquityGroup eg on a.equityGroupId=eg.equityGroupId
join LegalEntity.LegalEntity le on le.legalEntityId=eg.legalEntityId
where eg.positionHolderTypeId<>'b'and a.archived='n'and segregationStatus <>'h'
group by eg.legalEntityId,segregationStatus, le.name


Any help would be appreciated

Regards

Options: ReplyQuote


Subject
Written By
Posted
Help with using an "IFF" with "OR"
March 10, 2022 10:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.