SELECT
cscart_cp_popups.*
FROM
cscart_cp_popups
LEFT JOIN cscart_cp_popup_links ON cscart_cp_popups.popup_id = cscart_cp_popup_links.popup_id
LEFT JOIN cscart_companies ON cscart_companies.company_id = cscart_cp_popups.company_id
WHERE
cscart_cp_popup_links.link_object_id = 920
AND cscart_cp_popup_links.link_type = 'P'
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
limit
0,
1