我想要以下 SQL 查询的JQPL
语法:
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'