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