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