SELECT V.id,V.product_id,V.productnumber,P.saleprice,P.price,P.onsale,if(P.onsale=1,P.saleprice,P.price) as theprice
FROM sc_ws_products_variant V
LEFT JOIN sc_ws_products_price P ON P.product_variant_id=V.id
WHERE 1
ORDER BY V.product_id,theprice
Error!: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away