% of Total

E

Edgar

Hi

I want to design a query which will take info from
tblprices(priceid(PK) and tblprices(Company Id, price
date, high, low, mid, volume and sectors(sectorid(pk),
sectorname)

What I want to do is run a query for say 16/03/04 to
compare the volumes accross the sectors. tblprices is
linked to a companies table which is linked to the
tblsectors.

I take it I need a calculated field ie Volume for
sector/total volume for day but I do not know how to
phrase this.

Any help?

TIA
 
M

MGFoster

Edgar said:
Hi

I want to design a query which will take info from
tblprices(priceid(PK) and tblprices(Company Id, price
date, high, low, mid, volume and sectors(sectorid(pk),
sectorname)

What I want to do is run a query for say 16/03/04 to
compare the volumes accross the sectors. tblprices is
linked to a companies table which is linked to the
tblsectors.

I take it I need a calculated field ie Volume for
sector/total volume for day but I do not know how to
phrase this.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not sure what you mean by compare the volumes across the sectors.
Perhaps a cross-tab query would suit?

PARAMETERS [Enter Date] Date;
TRANSFORM Sum(P.Volume) As TheValue
SELECT P.[Date], Sum(P.Volume) As Total
FROM tblSectors As S INNER JOIN (tblCompanies As C INNER JOIN
tblPrices As P ON C.CompanyID = P.CompanyID) ON S.SectorID =
C.SectorID
WHERE P.[Date] = [Enter Date]
GROUP BY P.[Date]
PIVOT S.SectorName

If you want a percent of Volume per date use

TRANSFORM Avg(P.Volume) As TheValue

in place of what is there now.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQFoaP4echKqOuFEgEQL4FQCeOpRpE0lVn0z/nEKNNWwYuVUoI2UAn3S8
VOt5Z/RIZSWNbP9EQaH1OuOg
=ULJW
-----END PGP SIGNATURE-----
--
 
M

MGFoster

MGFoster wrote:
If you want a percent of Volume per date use

TRANSFORM Avg(P.Volume) As TheValue

in place of what is there now.

Oops! That won't get a percentage. Please excuse the error.
 

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

Top