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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -