-2

我想要以下 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'

请帮忙。

4

1 回答 1

0

尝试这个:

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'

于 2013-05-13T08:07:23.180 回答