query question

Newbie Member
6Sep2010,09:14   #1
jumpingtree's Avatar
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;


Go4Expert Member
21Feb2011,13:29   #2
apr pillai's Avatar
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