Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why my SQL gives me wrong results
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 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01140687
Message ID:
01140730
Vues:
15
This message has been marked as the solution to the initial question of the thread.
>Ha Ha! I'm ahead of you Boris. I've sent you an email.
>
>This is a slightly different table (hence the SQL similar but not the same). With the other table, ETMDATA, we just needed to catch the DATE of each record, being within the date range. This is non-ETM (i.e. not from an Electronic Ticket Machine), NOTETEM and each rec states how many passengers there were between 2 dates (as opposed to ETM where it was how many passnegers ON a date)
>
>Your servant, sir
>
>Terry
>
>>Did you use those table you sent once to me? If yes can you post the operator code and both periods to play with?
>>
>>>Hello again BB
>>>


Here final query :-)))
SELECT NET.Operator, NET.Route, NET.Start_Date, NET.End_Date, NET.RorF, NET.Passengers, ;
	IIF( NET.Route == NET.Mcl_Rte, "    ", NET.Mcl_Rte) as ContrNum, ;
	0000000 AS CurrPass, 0000000 AS PrevPass, op.Desc as OpDesc, rf.ServType ;	
  FROM NotETM NET ;
       JOIN Operator op  On NET.Operator == op.Code ;
       JOIN RteFam   rf  On NET.Operator == rf.Operator and NET.Route    == rf.ERoute ;
  WHERE ((m.ldStartCurr BETWEEN NET.Start_date AND NET.End_date)          OR;
         (m.ldEndCurr   BETWEEN NET.Start_date AND NET.End_date)          OR;
         (NET.Start_date < m.ldStartCurr AND NET.End_date > m.ldEndCurr)  OR;
         (m.ldStartPrev BETWEEN NET.Start_date AND NET.End_date)          OR;
         (m.ldEndPrev   BETWEEN NET.Start_date AND NET.End_date)          OR;
         (NET.Start_date < m.ldStartPrev AND NET.End_date > m.ldEndPrev)) AND;
         NET.Operator == lnOpCode;
  ORDER BY    NET.Operator, NET.Route &&;
INTO CURSOR csrNotETMPassengers NOFILTER READWRITE 
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform