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