Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a field from derived table in Where issue
Message
De
17/08/2011 16:37:53
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01521189
Message ID:
01521199
Vues:
42
>Hi,
>
>I can't seem to understand how to deal with the following issue.
>
>I have a SQL Select that uses derived table that creates a column, e.g. TOT_QTY. If there are no records in the LEFT JOIN (derived table) the value set to TOT_QTY is null. So in the SQL Select I use NVL( TOT_QTY, 0 ). And when I look at the resulting query I see that the records from the derived table are included with the value assigned to TOT_QTY as 0. So far so good. But if I include this column name in the WHERE clause (e.g. WHERE TOT_QTY > 0) none of the records are included in the query. It looks like the WHERE always uses the NULL value of the TOT_QTY and not the one that has been "processed" by NVL(). I hope my explanation is clear. What can I do to make the WHERE work in this case? TIA.

Can you move the condition into the HAVING clause?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform