Error: Table 'order' is marked as crashed and should be repaired
Error No: 1194
SELECT t.product_id, sum( t.total ) AS total FROM ( ( SELECT op.product_id, COUNT( * ) AS total FROM `order_product` op LEFT JOIN `order` o ON ( op.order_id = o.order_id ) LEFT JOIN `product` p ON ( op.product_id = p.product_id ) LEFT JOIN `product_to_store` p2s ON ( p.product_id = p2s.product_id ) LEFT JOIN `product_to_category` ptc ON ( p.product_id = ptc.product_id ) WHERE o.order_status_id > '0' AND p.status = '1' AND p.quantity > '0' AND p.price >0 AND (ptc.category_id = '90' OR ptc.category_id IN (SELECT category_id FROM `category` where parent_id='90') ) AND p.date_available <= NOW( ) AND p2s.store_id = '0' GROUP BY op.product_id ORDER BY total DESC LIMIT 6 ) UNION ( SELECT p.product_id, viewed AS total FROM `product` p LEFT JOIN `product_to_store` p2s ON ( p.product_id = p2s.product_id ) LEFT JOIN `product_to_category` ptc ON ( p.product_id = ptc.product_id ) WHERE p.status = '1' AND p.quantity > '0' AND p.price >0 AND (ptc.category_id = '90' OR ptc.category_id IN (SELECT category_id FROM `category` where parent_id='90') ) AND p.date_available <= NOW( ) AND p2s.store_id = '0' ORDER BY total DESC LIMIT 6 ) ) AS t GROUP BY product_id ORDER BY TOTAL DESC LIMIT 6