SELECT page_city.iPageID,
COUNT(page_city.iCityID)
FROM (
SELECT iPageID,
COUNT(iCityID) cnt
FROM page_city
GROUP BY iPageID
) cnt_page,
page_city
WHERE cnt_page.iPageID = page_city.iPageID
AND page_city.iCityID IN (:LIST)
GROUP BY iPageID
HAVING COUNT(iCityID) = cnt_page.cnt;
select * from tbl b
where b.date>= (select a.date from (select date from tbl
where id = 40
order by date) a
limit 1)
order by b.date;