Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LEFT JOIN causes Not Enough Memory
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00547778
Message ID:
00547781
Vues:
8
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform