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