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