SELECT
storefronts.*
FROM
cscart_storefronts AS storefronts
WHERE
1 = 1
AND (
storefronts.url = 'swglf.ru'
OR storefronts.url = 'www.swglf.ru'
OR storefronts.url LIKE 'www_.swglf.ru'
OR storefronts.url LIKE 'swglf.ru/%'
OR storefronts.url LIKE 'www.swglf.ru/%'
OR storefronts.url LIKE 'www_.swglf.ru/%'
)
GROUP BY
storefronts.storefront_id
ORDER BY
storefronts.url = 'swglf.ru' DESC,
storefronts.url = 'www.swglf.ru' DESC,
storefronts.url LIKE 'www_.swglf.ru' DESC,
storefronts.url LIKE 'swglf.ru/%' DESC,
storefronts.url LIKE 'www.swglf.ru/%' DESC,
storefronts.url LIKE 'www_.swglf.ru/%' desc