mysql - Getting all the records from Patient entity with primary insurance of the patient can be 'P' that is primary -
i want following sql query in jqpl
syntax:
select p.*,pin.insurance_company_id patient_insurance pin right join patient p on (pin.patient_id = p.id , pin.insurance_type = 'p' , pin.status = 'a') p.status = 'a'
please help.
try this:
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') patientinsurance pi right join patient p on pi.patientid = p.id
or if want records have pi.insurancetype ='p'
can append query : where pi.insurancetype ='p'
Comments
Post a Comment