We have just handled a similar problem here, and here is what we did.

Perform your original SQL and put it onto a temporary table (T1).
Write another SQL which which sums, totals, counts whatever you
want from T1 at whatever grouping level you want and puts it into
a new temporary (T2).

Now write a final SQL that looks someting like:

select T1.*
        , T2.*
from T1
        , T2
where T1.Val = T2.Val

This is what you use when generating your report.

This may seem like a fair amount of work, but as far as actual processing by
the SQL server goes is houldn't be much different from just running the
original query.

Stacey

> -----Original Message-----
> From: Mark Howard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 26 September 2001 4:06 p.m.
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Paradox SQL - Group totals as % of Grand total
> 
> 
> Craig said
>  
> > I'm not an SQL expert, but couldn't you first get the grand 
> total as a
> > variable (unsure whether it would be best to do a 
> preliminary query to
> > retrieve the single total or sum the total of the column in of your
> > current resultset - someone may be able to comment here).
> 
> Yeah, Craig, it was that second option that I was really getting at.  
> 
> Since there have been no other posts on this, I'll assume its 
> not possible
> (or that I have failed to adequately define the problem ;-)
> 
> Mark 
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to