Percentage Query

  • Thread starter Thread starter Sal
  • Start date Start date
S

Sal

Me again!
Forgot to ask this one.
Can I run a query that will return a percentage or where
work is sourced, ie if work is obtained from advertising,
recommendations and past clients, what percentage of the
work comes from advertising?
Any clever bods out there.
Going to sleep now - head hurts.
Thanks
Sal
 
Sal said:
Me again!
Forgot to ask this one.
Can I run a query that will return a percentage or where
work is sourced, ie if work is obtained from advertising,
recommendations and past clients, what percentage of the
work comes from advertising?
Any clever bods out there.
Going to sleep now - head hurts.
Thanks
Sal

Sal,

Making many assumptions:

CREATE TABLE MyTable_032604_1
(MyTableID INTEGER
,Source CHAR(24)
,Work CURRENCY
,CONSTRAINT pk_MyTable_032604_1 PRIMARY KEY (MyTableID)
)

Sample Data
1, Advertising, 25.00
2, Development, 50.00
3, Human Resources, 150.00
4, Advertising, 75.00


SELECT M1.Source
,(SUM(M1.Work) /
(SELECT SUM(M01.WORK)
FROM MyTable_032604_1 as M01)) AS PercentageWorkFromAdvertising
FROM MyTable_032604_1 AS M1
WHERE M1.Source = "Advertising"
GROUP BY M1.Source

Output
Advertising, 0.333333333333333


Sincerely,

Chris O.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top