Lost connection to server during query SQL query : SELECT categoryID, name, brief_description, customers_rating, Price, in_stock, customer_votes, list_price, sp.productID, default_picture, sort_order, items_sold, enabled, product_code, description, shipping_freight FROM ss_products sp LEFT JOIN ss_product_options_values spov on (spov.productID = sp.productID) where enabled=1 AND REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LOWER(meta_keywords), ' ', ''), '-', ''), '+', ''), '&', ''), '(', ''), ')', ''), 'Chengshan', ''), '@', ''), '*', ''), ',', ''), "'", "") LIKE '%mps320maxilla%' AND categoryID=79 AND REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(spov.option_value, ' ', ''), '-', ''), '+', ''), '&', ''), '(', ''), ')', ''), 'Chengshan', ''), '@', ''), '*', ''), ',', ''), "'", "") in ('matador') AND spov.optionID in (4) GROUP BY sp.productID HAVING COUNT(sp.productID) = 1 order by in_stock > 0 DESC, in_stock DESC