string(819) "
SELECT a.ID, b.meta_value*1 as med_license,
d.meta_value as doctor_status
FROM wp_4_posts a
INNER JOIN wp_4_postmeta b ON a.ID = b.post_id AND b.meta_key = '_med_license_number'
INNER JOIN wp_4_postmeta c ON a.ID = c.post_id AND c.meta_key = '_internal_id' AND c.meta_value IN (181500,140208)
INNER JOIN wp_4_postmeta d ON a.ID = d.post_id AND d.meta_key = '_doctor_staus_order'
WHERE a.post_status = 'publish'
AND a.post_type ='bch_doctor'
GROUP BY a.ID
ORDER BY
doctor_status ASC,
med_license ASC
"