gmundt Posted July 17, 2015 Share Posted July 17, 2015 I am wondering why the following query just spins in MySQL Workbench. SELECT ORD_Item, ORD_Desc, ORD_Item_Class, SUM(ORD_Qty), SUM(ROUND(ORD_Qty*ORD_Price,2)), `pos_item_descriptions`.ITEM_Desc FROM pos_ord_headers STRAIGHT_JOIN pos_ord_lines ON `pos_ord_headers`.`ORD_ID`=`pos_ord_lines`.`ORD_ID` LEFT JOIN pos_item_descriptions ON `pos_ord_lines`.`ORD_Item`=`pos_item_descriptions`.`ITEM_Number` WHERE `pos_ord_headers`.`ORD_Store`="0022" AND pos_ord_headers.ORD_Date BETWEEN"2015-06-01" AND "2015-06-30" AND pos_ord_lines.ORD_Item_Class IN ("Baskets") GROUP BY ORD_Item This query works: SELECT ORD_Item, ORD_Desc, ORD_Item_Class, SUM(ORD_Qty), SUM(ROUND(ORD_Qty*ORD_Price,2)), `pos_item_descriptions`.ITEM_Desc FROM pos_ord_headers STRAIGHT_JOIN pos_ord_lines ON `pos_ord_headers`.`ORD_ID`=`pos_ord_lines`.`ORD_ID` LEFT JOIN pos_item_descriptions ON `pos_ord_lines`.`ORD_Item`=`pos_item_descriptions`.`ITEM_Number` WHERE `pos_ord_headers`.`ORD_Store`="0022" AND pos_ord_headers.ORD_Date BETWEEN"2015-06-01" AND "2015-06-30" AND pos_ord_lines.ORD_Item_Class IN ("Ice Cream") GROUP BY ORD_Item And the only difference is the different class selection. Link to comment https://forums.phpfreaks.com/topic/297344-query-hangs/ Share on other sites More sharing options...
requinix Posted July 17, 2015 Share Posted July 17, 2015 What does EXPLAIN SELECT ORD_Item, ...output? Link to comment https://forums.phpfreaks.com/topic/297344-query-hangs/#findComment-1516665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.