1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

query question

Discussion in 'MS Access' started by jumpingtree, Sep 6, 2010.

  1. jumpingtree

    jumpingtree New Member

    Joined:
    Sep 6, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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;


     
  2. apr pillai

    apr pillai New Member

    Joined:
    Dec 17, 2010
    Messages:
    16
    Likes Received:
    12
    Trophy Points:
    0
    Occupation:
    Auditor
    Location:
    India
    Home Page:
    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 likes this.

Share This Page