Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Discarding Records with Null Values
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01422779
Message ID:
01422818
Vues:
24
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform