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