Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LEFT JOIN causes Not Enough Memory
Message
 
To
22/08/2001 23:40:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00547778
Message ID:
00547781
Views:
12
>Hi,
> I have the following SQL statement which cause NOT ENOUGH MEMORY
>
>SELECT Card_No AS cCardNo , s.SalesNo, s.sDate, s.pLocation AS Location, ;
>     IIF(ISNULL(sTotal - RAmount), 0, sTotal - RAmount) AS Total, ;
>     IIF(ISNULL(FLOOR(sTotal - RAmount)), 0, FLOOR(sTotal - RAmount)) AS SalesPoint  ;
>FROM Member n  LEFT JOIN Sales s  ;
>     ON Card_No == s.IDNumber  AND ( s.pLocation = 'ZONE 3    '  OR ;
>     s.pLocation = 'ZONE 2    '  OR  s.pLocation = 'DAMBR     '  OR ;
>     s.pLocation = 'ZONE 1    ' )  ;
>INTO CURSOR csrCustom
>
>
>
>Therefore, I change it to :
>
>SELECT Card_No AS cCardNo , s.SalesNo, s.sDate, s.pLocation AS Location, ;
>     IIF(ISNULL(sTotal - RAmount), 0, sTotal - RAmount) AS Total, ;
>     IIF(ISNULL(FLOOR(sTotal - RAmount)), 0, FLOOR(sTotal - RAmount)) AS SalesPoint  ;
>FROM Member n  LEFT JOIN Sales s  ;
>     ON Card_No == s.IDNumber  <B> WHERE </B> ( s.pLocation = 'ZONE 3    '  OR ;
>     s.pLocation = 'ZONE 2    '  OR  s.pLocation = 'DAMBR     '  OR ;
>     s.pLocation = 'ZONE 1    ' )  ;
>INTO CURSOR csrCustom
>
>
>However, it return wrong result. The PLocation condition is not evaluated correctly. Any ideas?
>
>Thank you

You might try
SELECT Card_No AS cCardNo , s.SalesNo, s.sDate, s.pLocation AS Location, ;
     NVL(sTotal - RAmount, 0) AS Total, ;
     NVL(FLOOR(sTotal - RAmount), 0) AS SalesPoint  ;
FROM Member n  LEFT JOIN Sales s  ;
     ON n.Card_No == s.IDNumber ;
     AND INLIST(s.pLocation,'ZONE 3    ','ZONE 2    ','DAMBR     ', 'ZONE 1    ' )  ;
INTO CURSOR csrCustom
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform