Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inconsistent Query Results
Message
From
12/04/2005 13:50:36
 
 
To
12/04/2005 12:01:48
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01003809
Message ID:
01003895
Views:
17
>Tried the following query in VFP9, VFP8, and VFP7. Records returned were 226, 236, and 232 respectively. I was expecting 263 because that is the number of records in the table on the left, RoseBran. Can anyone see what I'm missing here?
>
>SELECT RoseBran.ItemNo, ;
>       RoseBran.Descrip, ;
>       RoseBran.Descrip1, ;
>       SUM(ARSTrans.Shipped) as Shipped ;
>  FROM RoseBran ;
>  LEFT OUTER JOIN ARSTrans ;
>    ON RoseBran.ItemNo = ARSTrans.ItemNo ;
> WHERE BETWEEN(ARSTrans.DateShip,CTOD('2005/01/01'),DATE()) ;
> GROUP BY 1, 2, 3 ;
> ORDER BY 1 ;
>  INTO CURSOR TEMP
>
>TIA,

the correct is:
SELECT RoseBran.ItemNo, ;
       RoseBran.Descrip, ;
       RoseBran.Descrip1, ;
       SUM(ARSTrans.Shipped) as Shipped ;
  FROM RoseBran ;
  LEFT OUTER JOIN ARSTrans ;
    ON RoseBran.ItemNo = ARSTrans.ItemNo ;
 AND BETWEEN(ARSTrans.DateShip,CTOD('2005/01/01'),DATE()) ;
 GROUP BY 1, 2, 3 ;
; && ORDER BY 1 on VFP this is useless
  INTO CURSOR TEMP
Previous
Reply
Map
View

Click here to load this message in the networking platform