SELECT a.item_id as itemId, e.category_name as firCat, f.category_name as secCat, c.item_barcode as itemBarcode, c.cost_price as costPrice, c.item_original_price as itemOriginalPrice, c.item_name as itemName, b.quantity as quantity, a.cost_price as groupCostPrice, a.item_original_price as groupItemOriginalPrice, a.item_sell_price as groupItemSellPrice FROM mall_app_item a left JOIN mall_app_item_relevancy b ON (a.item_id = b.app_id) left JOIN mall_item c ON (b.item_id = c.item_id) left JOIN ( SELECT b.item_id, a.category_name FROM mall_item_category a LEFT JOIN mall_item_category_relevancy b ON ( a.category_id = b.category_id ) WHERE a.parent_id = 0 and a.category_type = '1' ) e on (a.item_id = e.item_id) left JOIN ( SELECT b.item_id, a.category_name FROM mall_item_category a LEFT JOIN mall_item_category_relevancy b ON ( a.category_id = b.category_id ) WHERE a.parent_id != 0 and a.category_type = '1' ) f on (a.item_id = f.item_id)
WHERE 1 = 1 AND a.item_store = 48 and a.item_type = '0'
SELECT a.item_id as itemId, e.category_name as firCat, f.category_name as secCat, c.item_barcode as itemBarcode, c.cost_price as costPrice, c.item_original_price as itemOriginalPrice, c.item_name as itemName, b.quantity as quantity, a.cost_price as groupCostPrice, a.item_original_price as groupItemOriginalPrice, a.item_sell_price as groupItemSellPrice FROM mall_app_item a, mall_app_item_relevancy b, mall_item c, ( SELECT b.item_id, a.category_name FROM mall_item_category a LEFT JOIN mall_item_category_relevancy b ON ( a.category_id = b.category_id ) WHERE a.parent_id = 0 and a.category_type = '1' ) e, ( SELECT b.item_id, a.category_name FROM mall_item_category a LEFT JOIN mall_item_category_relevancy b ON ( a.category_id = b.category_id ) WHERE a.parent_id != 0 and a.category_type = '1' ) f WHERE 1 = 1 and a.item_id = b.app_id and b.item_id = c.item_id and a.item_id = e.item_id and a.item_id = f.item_id AND a.item_store = 48 and a.item_type = '0'