SQL question: figuring percents on totals

SQL question: figuring percents on totals

Post by Anthony Valentin » Sat, 19 Jun 1999 04:00:00

Hello everybody!!

I have a quick SQL question that I am hoping someone will be able to

I am running a sql report that gives out that looks like the following:

Item  #    Sales                 Cost                     Profit
------  --------      -------             -----      ----
20            $36,311.13       $26,834.46        $9,476.67   26.10 %
30            $1,038.12         $607.22              $430.90      41.51
40            $538.49            $281.00              $257.49      47.82
------  ---------- ----------  --------  -------
Total:     $99,637.10       $72,678.05       $26,959.05

Can someone tell me how to figure the gross profit % (sales/profit) for
the totals?
I just can't seem to figure this one out.  I hope that it's possible and
I am just missing something simple.

An e-mailed response would be nice (to the address below), as I will be
out of town next week.

Thanks in advance!!

Anthony Valentine

Spenard Builders Supply


1. SQL: Percent of total count

This query gives the name of each company with the total number of
jobs per company.  How, please, can I add a column that will show the
percentage of the grand total number of jobs represented by each
company's total?

SELECT CompanyName, COUNT(*) AS JobCount
FROM tblCompany LEFT OUTER JOIN tblJob
        ON tblCompany.CompanyID = tblJob.CompanyID
GROUP BY Company Name


--David B.

2. pg_hba.conf on win32

3. Access/English Challenge Question: Calculate Totals rather than Total Totals in English/Access

4. SQL server acting weird

5. OLAP Calculated member for percent of total revenue.

6. XOR Operator !

7. MDX:Acumulated percent or total

8. Need Database Scripts !

9. Percent of Total Query Help

10. Calculated member - Percent of total

11. percent of total in a GROUP BY

12. Percent of total

13. Percent of Total in Crystal 4.5 Cross Tab Report