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