Unable to run pageCountMySQL server has gone awaySELECT COUNT(*) AS recCount FROM (SELECT distinct p.*,1 as IsVariation, SubItemSuffixCode, ItemSize, ItemColor, sp.ItemMainImage as SubItemMainImage, sp.ItemThumbImage as SubItemThumbImage, sp.ItemLargeImage as SubItemLargeImage, sp.ItemStock as SubItemStock, sp.IsSoldOut as SubItemIsSoldOut, sp.PageName as SubPageName, sp.SubItemPrice, sp.SubItemPriceType, sp.SubItemRRPPrice, sp.id as SubProductID FROM products p LEFT JOIN subproducts sp ON (p.id=sp.ProductID AND sp.Visible=1 AND sp.Deleted=0) LEFT JOIN products_categories pc ON (p.id=pc.ProductID) WHERE 1 AND p.`Deleted`=0 AND p.Visible=1 AND ( CategoryID1 IN (3,1,44,2,45,46,4,43,42) OR CategoryID2 IN (3,1,44,2,45,46,4,43,42) ) AND p.id NOT IN (536) AND p.visible=1 AND ( CategoryID1 IN (43) or CategoryID2 IN (43) or CategoryID IN (43) ) ) as t