SELECT count(1)
       ,min(id) as id
       ,b.blockheight
    FROM blocks b
   WHERE b.poolid IN (b.poolid, b.poolid||'-solo')
           AND b.status in ('pending','confirmed')
       group by b.blockheight
       HAVING count(id)>2