select distinct(t_vender.vender_id),t_vender.*,t_location.location_name province_name_eng
,amphurs.location_name amphur_name_eng
from t_vender left outer join t_location on t_vender.province_id=t_location.location_id and t_location.type_flg='P'
and t_location.status_flg='A'
left outer join t_location amphurs on t_vender.amphur_id=amphurs.location_id and amphurs.type_flg='A'
and amphurs.status_flg='A'
where (t_vender.status_flg='A' || t_vender.status_flg='P') and t_vender.pay_type >= 0 and t_vender.main_cat=127 and pay_type >= 0 order by t_vender.pay_type desc