SELECT et.id,et.custom,s.site_dir,et.default_page,t.dir as template_dir,t.style_dir as style_dir,et.entities_tree_id as aid, et.url, template_id, et.id as site_id, wset.id as site_entities_tree_id, fname, lname, email, company, address, city, state, country, postal, phone, fax, et.description, logo, slogan FROM web_entities_tree et JOIN web_sites_entities_tree wset on et.site_id = wset.id JOIN web_sites s ON s.id = wset.site_id JOIN web_templates t ON t.id = et.template_id WHERE REPLACE(et.url,'www.','') = 'test.jetimpact.com'