私は6テーブルに参加する以下のようなクエリを持っています。条件に基づいてこのクエリに参加する方法は?
私はこの条件が満たされていない場合、すなわち空(usr.userId = uident.USER_ID and uident.ID_TYPE = 1) or (usr.userId = uident.USER_ID and uident.ID_TYPE = 2)
メートルは、私は別の条件
(usr.userId = uident.USER_ID)
を追加する必要があり、それが唯一のmuliple行を返す場合、この行に
inner join TBL_NAFETHAH_USER_IDENTIFICATION uident on ((usr.userId = uident.USER_ID and uident.ID_TYPE = 1) or (usr.userId = uident.USER_ID and uident.ID_TYPE = 2))
を1つの以上の条件を入れたい
select usr.userid,usr.firstName,usr.middleName,usr.lastName,nuser.GRAND_FATHER_NAME,nco untry.NAME_AR,ncountry.NAME_EN,ncase.START_DATE
from User_ usr
inner join TBL_NAFETHAH_USER nuser
On nuser.USER_ID = usr.userId
inner join TBL_NAFETHAH_COUNTRY ncountry
on nuser.NATIONALITY = ncountry.ID
inner join TBL_NAFETHAH_CASE ncase
on usr.userId = ncase.inmate_id
inner join TBL_NAFETHAH_CASE_STATUS ncasestatus
ON ncase.CASE_STATUS_ID = ncasestatus.CASE_STATUS_ID
and ncasestatus.CASE_STATUS IN (1,2))
inner join TBL_NAFETHAH_CASE_STAGE ncasestage
on ncasestage.CASE_STAGE_ID = ncase.CASE_STAGE_ID
inner join TBL_NAFETHAH_USER_IDENTIFICATION uident
on ((usr.userId = uident.USER_ID and uident.ID_TYPE = 1) or (usr.userId = uident.USER_ID and uident.ID_TYPE = 2))
inner join TBL_NAFETHAH_LOOKUP_VALUE nlookup
on nlookup.LOOKUP_KEY = uident.ID_TYPE
and nlookup.CATEGORY_ID = 9
inner join TBL_NAFETHAH_LOOKUP_VALUE nlookup2
on nlookup2.LOOKUP_KEY = ncasestage.CASE_STAGE
and nlookup2.CATEGORY_ID = 15
where nuser.MAKE_PUBLIC = 1
最初の行を取る。
どのように達成するには?