Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   query question (http://www.go4expert.com/forums/query-question-t23218/)

jumpingtree 6Sep2010 09:14

query question
 
how to adapt the fragment of code below to show:
a) Two columns - the Filipino Population and the Total Population
b) The Filipino Population as a percentage of the total population

SELECT DISTINCTROW POPDATA.CITYNUM,
COUNT (*) FROM POPDATA
WHERE POPDATA.ANCNUMBER=720
GROUP BY POPDATA. CITYNUM
ORDER BY COUNT (*) DESC;



apr pillai 21Feb2011 13:29

Re: query question
 
Modify the SQL as given below:

Code:

SELECT DISTINCTROW POPDATA.CITYNUM,

COUNT(POPDATA.CITYNUM) AS COUNT,
DCOUNT("*","POPDATA") AS TOTAL
count(POPDATA.CITYNUM)/DCOUNT("*","POPDATA") AS PERCENTAGE

FROM POPDATA
WHERE POPDATA.ANCNUMBER=720
GROUP BY POPDATA. CITYNUM
ORDER BY COUNT (POPDATA.CITYNUM) DESC;



All times are GMT +5.5. The time now is 07:16.