Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outer Join Won't Limit Records
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00120154
Message ID:
00120196
Views:
20
>All you SELECT gurus out there - Help me!!!
>
>I've a SELECT that used to work, but now appears to not be working. It's returning records that match on chgitem, but is ignoring the effdate criteria. How do I get this to work?
>
>SELECT chgitem, units, amount, NVL(lcdm.cost, 0.0000) AS cost ;
> FROM ccharges LEFT OUTER JOIN lcdm ON ccharges.chgitem = lcdm.chgitem ;
> AND ccharges.chgdate BETWEEN lcdm.effdate AND lcdm.enddate
>
>The return set is giving me multiple records for a chgitem regardless of the effdate match. I've tried putting the chgdate clause in the WHERE clause as well as a HAVING clause all to no avail.
>
>Thanks in advance.
Curtis,

Here's an adjustment that takes the non join criteria out of the join clause.
SELECT chgitem, units, amount, NVL(lcdm.cost, 0.0000) AS cost ;
  FROM ccharges LEFT OUTER JOIN lcdm ON ccharges.chgitem = lcdm.chgitem ;
 WHERE ccharges.chgdate BETWEEN lcdm.effdate AND lcdm.enddate
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform