SELECT A FROM (SELECT A,B FROM TABLE) T where A='XXXX';
select name, count from (select b.name name, sum(c.count) count from websites b inner join access_log c on b.id = c.site_id
group by c.site_id) d where d.count > 500
SELECT A FROM (SELECT A,B FROM TABLE) T where A='XXXX';
select name, count from (select b.name name, sum(c.count) count from websites b inner join access_log c on b.id = c.site_id
group by c.site_id) d where d.count > 500