我想在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