Change mysql query to have unique domain

Placeholder to be changed with script