SQL Query Error
(SELECT plan.*,
                       (plan.level + (1-1/plan.left_index) ) AS position_order,
                       parent.name AS group_name, parent.id AS ref_group,
                       rent_logic.name AS rent_logic_name,
                       plan_category.name AS category_name,
                       SUM(plan_part.duration) AS total_duration,
                       ROUND( SUM(plan_part.total_price), 2) AS total_price, 
                       plan_max_item_count.max_at_time, plan_max_item_count.max_per_period, plan_max_item_count.min_queue,  CONCAT('http://www.hmongflix.com/materials/images/plans/', plan.id, '.png') AS image_file_src  FROM (plans AS plan
                INNER JOIN plan_max_item_counts AS plan_max_item_count ON plan_max_item_count.ref_plan = plan.id and plan_max_item_count.ref_item_type = 1
                INNER JOIN rent_logics AS rent_logic ON plan.ref_rent_logic = rent_logic.id
                INNER JOIN plan_categories AS plan_category ON plan.ref_category = plan_category.id)

                LEFT JOIN plan_parts AS plan_part ON plan_part.ref_plan = plan.id
                LEFT JOIN plans AS parent ON ( plan.left_index > parent.left_index AND plan.right_index < parent.right_index AND plan.level = parent.level+1 )
                  WHERE 1  AND plan.ref_category = '1'  AND plan.level <> 0  GROUP BY plan.id ORDER BY id ASC)
Got error 122 from storage engine