SELECT `xf_siropu_ads_manager_ad`.*, `xf_siropu_ads_manager_package_Package_1`.*
FROM `xf_siropu_ads_manager_ad`
LEFT JOIN `xf_siropu_ads_manager_package` AS `xf_siropu_ads_manager_package_Package_1` ON (`xf_siropu_ads_manager_package_Package_1`.`package_id` = `xf_siropu_ads_manager_ad`.`package_id`)
WHERE (`xf_siropu_ads_manager_ad`.`type` IN ('keyword', 'affiliate')) AND (`xf_siropu_ads_manager_ad`.`status` = 'active')
ORDER BY RAND() ASC