Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie at select statements
Message
From
02/11/2000 11:29:27
 
 
To
01/11/2000 17:35:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436920
Message ID:
00437157
Views:
28
>In the 2nd one, the outer records - i.e., the records for scorder table that don't match the records in the scordln table - are included in the results, and therefore in the sum.
>Add the bold line below to make the 2nd one behave like the first.
>
>
select sum(scordln.orl_qty-scordln.orl_qtyinvoiced) as nqty ;
>  from scordln left outer join scorder ;
>  on scordln.orl_order = scorder.ord_order ;
>  where scorder.ord_acct < 201 ;
>  <b>having !isnull(scorder.ord_acct)</b> ;
>  into cursor cqty
>

I swear this worked when I tested it before I posted it yesterday, but I tried it again today and it didn't. I was surprised that it did work, because HAVING is supposed to only work with a GROUP BY.

Since the one with the BETWEEN() works - just go with that one. <s>

For a good explanation of what's happening, see Ed Rauh's response to me on the other thread. Message#437085
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform