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