Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query showing bad result
Message
De
29/08/2010 08:12:19
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
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 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01479089
Message ID:
01479093
Vues:
39
That's still not much information to solve the problem... But here are some ideas, of what MIGHT go wrong.

First, don't use ctod() in the comparisons. Use unambiguous date constants, in this case, {^2010-06-20}

Second, please note that the way you are combining conditions with AND, all the conditions must be fulfilled for the record to be included. Check whether you have records that fulfill those conditions.

>>Perhaps you should explain what is the difference between the expected result, and the result you actually get?
>>
>>>I have three queries, then i joint. but not correct result.
>>>
>>>
>>>
>>>SELECT  Hwsv.year,Hwsv.scode,Hwsv.lcode,Hwsv.sec, Hwsv.perc,COUNT(*)as nowork,;
>>>  Student.sex;
>>> FROM ;
>>>     student ;
>>> left JOIN hwsv ;
>>>   ON  Student.code = Hwsv.code;
>>>    WHERE  Hwsv.year=thisform.year.value AND hwsv.scode=thisform.scoDE.Value and Hwsv.perc<50 AND student.admtd=1 AND student.joind<CTOD("20/06/2010") ;
>>>              ORDER BY hwsv.lcode;
>>>              GROUP BY hwsv.lcode,hwsv.sec;
>>>              INTO cursor nowork
>>>  
>>> brows
>>>    SELECT Hwsv.year,Hwsv.scode,Hwsv.lcode,Hwsv.sec, Hwsv.perc,COUNT(*) as completee,;
>>>  Student.sex;
>>> FROM ;
>>>     student ;
>>> left    JOIN hwsv ;
>>>   ON  Student.code = Hwsv.code;
>>>    WHERE  Hwsv.year=thisform.year.value AND hwsv.scode=thisform.scoDE.Value AND Hwsv.perc =100 and student.admtd=1 AND student.joind<CTOD("20/06/2010");
>>>              GROUP BY hwsv.lcode,hwsv.sec;
>>>       ORDER BY hwsv.lcode;
>>>             INTO cursor com
>>>                 brows
>>>      
>>>      
>>>      
>>>       SELECT Hwsv.year,Hwsv.scode,Hwsv.lcode,Hwsv.sec, Hwsv.perc,COUNT(*) as incompl ,;
>>>  Student.sex;
>>> FROM ;
>>>     student ;
>>>    left JOIN hwsv ;
>>>   ON  Student.code = Hwsv.code;
>>>    WHERE  Hwsv.year=thisform.year.value AND hwsv.scode=thisform.scoDE.Value AND Hwsv.perc <100 and Hwsv.perc>49 AND student.admtd=1 AND student.joind<CTOD("20/06/2010");
>>>              GROUP BY hwsv.lcode,hwsv.sec;
>>>       ORDER BY hwsv.lcode;
>>>       INTO CURSOR incom
>>>
>>>
>>>SELECT Com.*, Incom.*, Nowork.*;
>>> FROM ;
>>>     com ;
>>>   LEFT JOIN incom ;
>>>   ON  Com.scode = Incom.scode;
>>>   AND  Com.lcode = Incom.lcode;
>>>   AND  Com.sec = Incom.sec ;
>>>    left JOIN nowork ;
>>>   ON  Com.scode = Nowork.scode;
>>>   AND  Incom.lcode = Nowork.lcode;
>>>   AND  Incom.sec = Nowork.sec;
>>>       INTO CURSOR  ghu10cc
>>>
>some result is missing from first query
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform