Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Discarding Records with Null Values
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01422779
Message ID:
01422818
Views:
25
>>How can I keep the records where f1 is NULL from being included in result?
>>
>>
>>testconnString = "Select webprddt6.resmngta0.recseq, webprddt6.resmngta0.jobno, webprddt6.resmngta1.schedtype," +;
>>" Case When schedtype = 0 Then(Select SUM(taskdur) As tDur From webprddt6.resmngta3 Where schdindex = webprddt6.resmngta1.recseq And ftdatem > '09/01/2009')" +;
>>" When schedtype = 1 Then(Select SUM(taskdur) As tDur From webprddt6.resmngta3d Where schdindex = webprddt6.resmngta1.recseq And ftdatem > '09/01/2009')" +;
>>" End As f1" +;
>>" From webprddt6.resmngta0" +;
>>" Join webprddt6.resmngta1 On webprddt6.resmngta1.projindex = webprddt6.resmngta0.recseq" +;
>>" Where status = 1 And deptno = '670' And projected = 0"
>>
>
>
>Use your SELECT as derived table and then put WHERE clause:
>
>SELECT * FROM (
>Select webprddt6.resmngta0.recseq, 
>       webprddt6.resmngta0.jobno,
>       webprddt6.resmngta1.schedtype, 
>       Case When schedtype = 0 
>                 Then (Select SUM(taskdur) As tDur 
>                               From webprddt6.resmngta3 
>                       Where schdindex = webprddt6.resmngta1.recseq And
>                             ftdatem > '20090901')
>            When schedtype = 1 
>                 Then(Select SUM(taskdur) As tDur 
>                             From webprddt6.resmngta3d 
>                      Where schdindex = webprddt6.resmngta1.recseq And 
>                            ftdatem > '20090901')
>       End As f1
>From webprddt6.resmngta0
>Join webprddt6.resmngta1 On webprddt6.resmngta1.projindex = webprddt6.resmngta0.recseq
>Where status = 1     And 
>      deptno = '670' And
>      projected = 0) Tbl1
>WHERE F1 IS NOT NULL
>
I wanted to suggest the same solution. I don't think we can use HAVING without group by.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform