Personally I avoid _TALLY since so many commands & functions in VFP will change 
it.

--

rk

-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Ted Roche
Sent: Thursday, June 21, 2018 1:56 PM
To: [email protected]
Subject: Re: Query Involving Sums and Two Most Recent Dates

Yeah, that's worth testing, and GMail doesn't tell me that :) I'm
guessing _TALLY should be the number, but you can always check
RECCOUNT() of the query result.

On Thu, Jun 21, 2018 at 1:32 PM, Ken Dibble <[email protected]> wrote:
> Er... and while still rendering a total number of Consumers whose hours were
> totalled--at least via _TALLY if nothing else.
>
>
>>> I should have realized that from your example solution. I *ASSuMEd* we
>>> were totalling hours. My bad.
>>>
>>> SELECT Consumer.*, Status.*, Hours.AppHours
>>> FROM Consumer
>>> JOIN Status on Consumer.ConPK=Status.ConFK
>>> JOIN Hours on Consumer.ConPK=Hours.ConFK
>>> WHERE Status.Date =
>>> (SELECT MAX(Stat2.Date) FROM Status Stat2 WHERE
>>> Stat2.ConFK = Consumer.ConPK GROUP BY Stat2.ConFK)
>>> AND Status.Type = "Approved"
>>> AND Hours.Date = Status.Date
>>
>>
>> Better, but there is no guarantee that Hours.Date will equal Status.Date.
>>
>>
>> And my testing indicates that a GROUP BY clause is required somewhere.
>>
>> I'm wondering if this will turn out to be np-hard and my original
>> multi-query approach is the only way to do this.
>>
>> Thanks.
>>
>> Ken
>>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/dm5pr10mb124418dae24d3356f0095dced2...@dm5pr10mb1244.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to