Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL changed its mind again
Message
From
29/07/2006 08:44:20
 
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxExpress
Miscellaneous
Thread ID:
01141384
Message ID:
01141475
Views:
27
Terry,

>The following code was happily and successfully selecting data for just the chosen operator, now its gone back to selecting all operators (or damn near all). I don't know what I've done to make it change its mind.
>
>Any ideas?

not clear while it should be misbehaving, but I'ld lean more to:
*-- set enginebehaviour 80/90 <g>
SELECT ;
  ET.Mcl_Rte, ET.Operator, ET.Route, ET.Class ;
  , Max(ET.Date) as et_date, Max(ET.RorF) as et_RorF ; 
  , Max(op.Desc) as OpDesc ;
  , Max(RF1.ServType) as ServType ;
  , IIF( ET.Route == ET.Mcl_Rte, "    ", ET.Mcl_Rte) as ContrNum ;
  , SUM( IIF( BETWEEN( ET.date, m.ldStartCurr, m.ldEndCurr), ET.Number, 0000000)) AS CurrPass ;
  , SUM( IIF( BETWEEN( ET.date, m.ldStartPrev, m.ldEndPrev), ET.Number, 0000000)) AS PrevPass ;
  FROM ETMData ET ;
    JOIN Operator op ;
	On  op.Code == ET.Operator ;
    JOIN RF1 ;
	On     RF1.Operator  == ET.Operator  ;
	  and  RF1.ERoute    == ET.Route  ;
  WHERE ET.Operator  == m.lnOpCode ;
    And (    ET.date BETWEEN m.ldStartCurr and m.ldEndCurr ;
  	  OR ET.date BETWEEN m.ldStartPrev and m.ldEndPrev) ;
  GROUP BY ET.Mcl_Rte, ET.Operator, ET.Route, ET.Class ;
  ORDER BY ET.Operator, ET.Route, ET.Class ;
  INTO CURSOR csrETMPassengers NOFILTER
since this should be equivalent (==) and filters the first table looked at.

my 0.02 EUR

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform