SELECT
tmall_categories.category_id,
tmall_categories.parent_id,
tmall_categories.id_path,
tmall_category_descriptions.category,
tmall_categories.position,
tmall_categories.status,
tmall_categories.company_id,
tmall_categories.storefront_id,
tmall_categories.ab__lc_catalog_image_control,
tmall_categories.ab__fn_category_status,
tmall_categories.ab__fn_label_color,
tmall_categories.ab__fn_label_background,
tmall_categories.ab__fn_use_origin_image,
tmall_category_descriptions.ab__fn_label_text,
tmall_category_descriptions.ab__fn_label_show
FROM
tmall_categories
LEFT JOIN tmall_category_descriptions ON tmall_categories.category_id = tmall_category_descriptions.category_id
AND tmall_category_descriptions.lang_code = 'en'
WHERE
1 = 1
AND (
tmall_categories.usergroup_ids = ''
OR FIND_IN_SET(
0, tmall_categories.usergroup_ids
)
OR FIND_IN_SET(
1, tmall_categories.usergroup_ids
)
)
AND tmall_categories.status IN ('A')
AND tmall_categories.parent_id IN (247)
AND tmall_categories.id_path LIKE '245/247/%'
AND tmall_categories.storefront_id IN (0, 1)
ORDER BY
tmall_categories.is_trash asc,
tmall_categories.position asc,
tmall_category_descriptions.category asc