我想在JQPL
語法下面的SQL查詢:獲得所有與患者的主險患者實體記錄可以「P」是主要
select P.*,PIN.INSURANCE_COMPANY_ID
from PATIENT_INSURANCE PIN
right join PATIENT P ON (PIN.Patient_ID = P.ID
and PIN.INSURANCE_TYPE = 'P' AND PIN.STATUS = 'A')
where P.STATUS = 'A'
請幫助。
我想在JQPL
語法下面的SQL查詢:獲得所有與患者的主險患者實體記錄可以「P」是主要
select P.*,PIN.INSURANCE_COMPANY_ID
from PATIENT_INSURANCE PIN
right join PATIENT P ON (PIN.Patient_ID = P.ID
and PIN.INSURANCE_TYPE = 'P' AND PIN.STATUS = 'A')
where P.STATUS = 'A'
請幫助。
試試這個:
select
p.id,
p.lastName,
p.firstName,
p.middleName,
p.dob,
p.sex,
p.ssn,
p.phone,
p.status,
pi.insuranceCompanyId ,
IF(pi.insuranceType ='P' , 'is P', 'is not P')
from
PatientInsurance pi
right join Patient p
on pi.patientID = p.id
或者,如果你希望所有具有pi.insuranceType ='P'
記錄可以追加到查詢: WHERE pi.insuranceType ='P'
我有患者表和PATIENT_INSURANCE TABLE。 – user2376847 2013-05-13 10:15:45
我已更新查詢,請立即嘗試 – Stephan 2013-05-13 10:18:14
你的問題是模糊的,有給你的樣品不清楚連接粘貼。請提供清晰的背景,指明您想要做什麼,問題是什麼以及您在尋找什麼幫助。 – 2013-05-13 08:23:51