Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inconsistant result in SQL Coumn
Message
 
 
To
17/06/2002 15:02:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00669395
Message ID:
00669473
Views:
13
My guess would be that it has something to do with rounding. Try to perfor calculations on the results of SUM().
SELECT ;
		INCF1.IENTID AS RETCENTNO, ;
		INCF1.iYr AS YLSTIYR, ;
		...
		SUM(ENERBALIOU.bTotGener) - SUM(ENERBALIOU.bLessPump) + ;
		SUM(ENERBALIOU.bPurchases) + SUM(ENERBALIOU.bExchgIn) - ;
		SUM(ENERBALIOU.bExchgOut) + SUM(ENERBALIOU.bWheelIn) - ;
		SUM(ENERBALIOU.bWheelOut) + SUM(ENERBALIOU.bWheelByLoss) AS ERROR1, ;
		...
		SUM(ENERBALIOU.bWholesaleReq) + SUM(ENERBALIOU.bWholesaleNon) AS ERROR2, ;
		SUM(ENERBALIOU.bRetailSale) + ;
		SUM(ENERBALIOU.bWholesaleReq) + SUM(ENERBALIOU.bWholesaleNon) AS ERROR3, ;
		...
		SUM(ENERBALIOU.bRetailSale) + SUM(ENERBALIOU.bWholesaleReq) + ;
		SUM(ENERBALIOU.bWholesaleNon) + SUM(ENERBALIOU.bEnerNoChg) + ;
		SUM(ENERBALIOU.bEnerUsed) + SUM(ENERBALIOU.bEnerLoss) AS ERROR4 ;
	FROM ;
	INCF1 INCF1, ;
	ENERBALIOU ENERBALIOU ;
	WHERE ;
	INCF1.UKEY = ENERBALIOU.UKEY AND ;
	INCF1.UKEY = "00000000001004642001" ;
	GROUP BY 1, 2 ;
	INTO TABLE 'results'
>Hi,
>
>I have a SQL select statement that is giving inconsistent results for columns that do addition and/or subtraction within a sum(). (I labeled theses columns with an "AS" name beginning with "Error" 1-4 to make them easy to find). The odd thing is that if I remove a column the proceeds one of the error columns it gives a correct result.
>
>By my count I have not exceeded the 8192 character or 255 field limitations.
>
>Do you have any suggestions on what the probelm might be and how to fix it?
>
>I have attached the select statement below. I run vfp7 on win2k. I have the same problem on vfp6. I believe I have the latest service packs installed on everything.
>
>I'll be happy to send you tables if you like.
>
>TIA Chris Voeller
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform