query question

jumpingtree's Avatar
Newbie Member
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;


0
apr pillai's Avatar, Join Date: Dec 2010
Go4Expert Member
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;
shabbir like this