Database query error ! : SQLSTATE[HY000]: General error: 23 Out of resources when opening file './mom2kids/shop_bestseller_last2week.MYD' (Errcode: 24)
SELECT shop_bestseller_last2week.amount,
(CASE WHEN IFNULL(pc.in_stock_all, shop_product.in_stock_all) >0 THEN
1
ELSE
CASE WHEN warning_stock = 0 THEN
0
ELSE
CASE WHEN warning_stock = 2 THEN
-1
ELSE
-2
END
END
END)
as istock,
shop_product.* ,po.option_id, po.option_name_th, pc.choice_id, pc.choice_name_th,
pc.in_stock_all,
IFNULL(pc.datetime_add, shop_product.datetime_add) as dt
FROM shop_product
LEFT JOIN shop_product_option po ON shop_product.product_id = po.product_id
AND po.is_group =1
LEFT JOIN shop_product_option_choice pc ON po.product_id = pc.product_id
AND po.option_id = pc.option_id
AND pc.status = 1
LEFT JOIN shop_bestseller_last2week ON
shop_product.product_id=shop_bestseller_last2week.product_id AND
IFNULL(pc.option_id, 0)=shop_bestseller_last2week.option_id AND
IFNULL(pc.choice_id, 0)=shop_bestseller_last2week.choice_id
WHERE shop_product.product_id in
( SELECT product_id
FROM shop_product_category
WHERE cat_id in (346) )
and shop_product.product_id in (select product_id from shop_product_type where type_id<>2 and option_id=1 and type_value in ('1','7','39','226','284','306','332','346','353')) and shop_product.status<>0 and shop_product.show_web = 1 and shop_product.price_net > 0
ORDER BY istock DESC,shop_bestseller_last2week.amount asc, dt desc
LIMIT 0,12