Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select (SQL) -- field does not accept NULL values
Message
From
20/09/2004 14:11:59
 
 
To
05/02/2004 15:00:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00692839
Message ID:
00944114
Views:
24

Is there a solution if there are multiple functions involved. For example:

select field1, sum(nullfield1/IIF(field2>0,nullfield2,nullfield3) as result from sometable group by 1


The problem is I need to run a select that has a formula for a weighted average, not the AVG() function. This requires a difficult expression with several other functions.

I also have the need for an expression in a select that divides two sum() calculations, with the second sum being multiplied by 1000 to get the units correct. I have a specialized divide() function that I wrote that works with nulls, /0 errors, but this still causes problems. Any ideas?


Sorry, i have not seen this until today.

This is a old VFP bug.

WorkAround, use NVL():
CREATE CURSOR myCursor ( f1 I)
APPEND BLANK
lcName = LTRIM(NULL)
SELECT m.lcName		     from myCursor	&& error
SELECT EVL(.F.,m.lcName)     from myCursor	&& error
SELECT NVL(NULL,m.lcName)    from myCursor	&& good
Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform