MySQL Forums
Forum List  »  Optimizer & Parser

"Optimizing sub queries with joins"
Posted by: SUNIL KUMAR
Date: December 01, 2010 10:42PM

can any one help me optimizing the querie.

SELECT
T1.PATIENT_ID,T1.PATIENT_PAID AS VP_PAT,T2.PAID AS LD_PAT,T1.STATUS
FROM ((SELECT
PROCEDURE_ID,
PATIENT_PAID,
PATIENT_ID,STATUS
FROM VISIT_PROCEDURE
WHERE CLINIC_ID = 97846) AS T1
LEFT JOIN (SELECT
PROCEDURE_ID,
SUM(AMOUNT) AS PAID
FROM LEDGER
WHERE TYPE IN(5,8)
AND CURR_PARTY = 4
AND CLINIC_ID = 97846 GROUP BY PROCEDURE_ID
) AS T2
ON T1.PROCEDURE_ID = T2.PROCEDURE_ID)
WHERE ROUND(T1.PATIENT_PAID,1) <> ROUND(T2.PAID,1)

Thanks
Sunil

Options: ReplyQuote


Subject
Views
Written By
Posted
"Optimizing sub queries with joins"
2148
December 01, 2010 10:42PM
1055
December 05, 2010 12:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.