Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a field from derived table in Where issue
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01521189
Message ID:
01521202
Views:
51
This message has been marked as a message which has helped to the initial question of the thread.
Use the same expression that you use in the column list
WHERE NVL(TOT_QTY, 00000000) > 0
Updated: I just saw that you figured it out after I push Send. Sorry!

>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform