SELECT
cscart_cp_popups.*
FROM
cscart_cp_popups
LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_cp_popups.company_id
WHERE
cscart_cp_popups.section IN ('A', 'U')
AND cscart_cp_popups.status = 'A'
AND (
cscart_cp_popups.usergroup_ids = ''
OR FIND_IN_SET(
0, cscart_cp_popups.usergroup_ids
)
OR FIND_IN_SET(
1, cscart_cp_popups.usergroup_ids
)
)
AND cscart_companies.company_id = 1
ORDER BY
cscart_cp_popups.priority DESC