Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select (SQL) -- field does not accept NULL values
Message
De
20/09/2004 14:11:59
 
 
À
05/02/2004 15:00:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00692839
Message ID:
00944114
Vues:
23

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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform