Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More GROUP BY problems...
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
More GROUP BY problems...
Miscellaneous
Thread ID:
00892909
Message ID:
00892909
Views:
45
I cannot figure out why my query is not grouping the way I expect (VFP8):
SELECT 0000000000+SUM(NVL(WeekShips.Shipped,0)) AS nShipped, ;
	0000000000+SUM(NVL(WeekSales.Sales,0)) AS WeekSales, ;
	0000000000+SUM(NVL(YTDSales.Sales,0)) AS YTDSales, ;
	ItemSetup.Retail, 0000000000+NVL(iciwhs.nOnHand,0) AS nOnHand ;
	FROM ItemSetup ; 
	INNER JOIN ItemSales ON ItemSetup.cItemNo = ItemSales.cItemNo ;
		AND ItemSales.Category = "TRANSFER" ;
	LEFT JOIN WeekShips ON WeekShips.cItemNo = ItemSetup.cItemNo ;
	LEFT JOIN WeekSales ON WeekSales.UnitRetail = ItemSetup.Retail ;
	LEFT JOIN IciWhs ON iciWhs.cItemNo = ItemSetup.cItemNo ;
	LEFT JOIN YTDSales ON YTDSales.UnitRetail = ItemSetup.Retail ;
	ORDER BY ItemSetup.Retail, nOnHand ; 
	GROUP BY ItemSetup.Retail, nOnHand ;
	HAVING YTDSales > 0 ;
	INTO CURSOR SpreadsheetResults
My resulting cursor has many records for each "retail" value! Any idea why?
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Next
Reply
Map
View

Click here to load this message in the networking platform