Adapting a Code

  • Hey! I just want to know how I can adapt the following fragment of code:

    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;

  • crap someone else asked this exact same question a while ago and i answered it;

    is this a homework question?

    http://www.sqlservercentral.com/Forums/Topic968341-131-1.aspx

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Since I don't support cheating I decided to remove my solution from the thread Lowell mentioned. I'm sorry for all those who might have found it useful in a more ethical way.

    @abe.nito

    You're not the first one asking this question and this is not the only forum the question has been asked. At least, some of those folks were honest enough to say it is for a computer science project...

    If you would have been, we would have tried to guide you in the right direction. Probably even with some explanation why you should or shouldn't use one or the other method. You just missed that opportunity, I guess.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Sorry about not indicating it was for a homework, guys! The homework is actually trying to get an expert advice on how to do it and trying to apply that expert advice. We weren't taught how to do anything related to it so I really have no idea how. It would be very much appreciated if you guys could still help me out. If not, it's alright! Thanks!

  • abe.nito (9/3/2010)


    Sorry about not indicating it was for a homework, guys! The homework is actually trying to get an expert advice on how to do it and trying to apply that expert advice. We weren't taught how to do anything related to it so I really have no idea how. It would be very much appreciated if you guys could still help me out. If not, it's alright! Thanks!

    Are you serious? Your professor is telling you to get an expert advie and modify it???

    If that's the case, I'd like to know the name of the university as well as the name of your professor so I can try to contact him and have a rather serious smalltalk about how (s)he supports cheating. I can't think of any valid reason to search for an "expert advice" without even trying to solve the puzzle. Weird....



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Ignore the query.

    How do you get this answer if you have the populations?

    Now, how do you get the populations in a query?

    Apply the math to the query. It's not that hard.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply