SELECT
cscart_promotions.*,
cscart_promotion_descriptions.name,
cscart_promotion_descriptions.detailed_description,
cscart_promotion_descriptions.short_description
FROM
cscart_promotions
LEFT JOIN cscart_promotion_descriptions ON cscart_promotion_descriptions.promotion_id = cscart_promotions.promotion_id
AND cscart_promotion_descriptions.lang_code = 'ja'
INNER JOIN cscart_ult_objects_sharing ON (
cscart_ult_objects_sharing.share_object_id = cscart_promotions.promotion_id
AND cscart_ult_objects_sharing.share_company_id = 1
AND cscart_ult_objects_sharing.share_object_type = 'promotions'
)
WHERE
1
AND IF(
from_date, from_date <= 1776141012,
1
)
AND IF(to_date, to_date >= 1776141012, 1)
AND status IN ('A', 'H')
AND cscart_promotions.zone = 'catalog'
ORDER BY
cscart_promotions.priority asc