Failed to execute the SQL query

select f.id, f.name, count(*) as cnt  from  ipo__item  i  inner join  ipo__channels  c on c.id = i.cid  inner join  ipo__folders  f on f.id = c.parent  where i.unread & 1 and not(i.unread & 8) and not(unread & 4)  and not(c.mode & 8)  group by f.id

Error 2013: Lost connection to server during query