Help With Modifying this Code

  • Hey guys, I'm new here. But I hope you can help me with modifying this code (in regards with the Census)...

    SELECT DISTINCTROW POPDATA.CITYNUM,

    COUNT (*) FROM POPDATA

    WHERE POPDATA.ANCNUMBER=720

    GROUP BY POPDATA.CITYNUM

    ORDER BY COUNT (*) DESC;

    ...so that it can show two things.

    (1.) Two columns- which is of the Filipino Population and the Total Population

    (2.) The Filipino Population as a percentage of the total population.

    Thanks in advance guys! 🙂

  • here's my wild guess:

    --EDITED/REMOVED, as this is a homework question;

    see a second students post at

    http://www.sqlservercentral.com/Forums/Topic979463-23-1.aspx#bm979690

    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!

  • What software is the solution for?

    You posted in the ACCESS forum so Lowells solution might not help if you're looking for ACCESS code. Please clarify.



    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]

  • good eyes!

    i assumed his "DISTINCTROW" was an error and he meant DISTINCT...i should have noticed which forum;

    LutzM (8/12/2010)


    What software is the solution for?

    You posted in the ACCESS forum so Lowells solution might not help if you're looking for ACCESS code. Please clarify.

    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!

  • Hey guys thanks for the replies! 🙂

    And yes, the code is for MS Access

  • I'm not sure if the syntax is correct but IIRC this is the way to code the CASE statement in ACCESS

    ...

    Edit: Based on this link it seems like a homework question. So I decided to remove my solution. Sorry.

    Unfortunately, people like the OP tend to spend a lot more time posting their homework on different forums rather than try to figure it out by themself.

    At least, some of those folks were honest enough to say it is for a computer science project.

    Similar questions can be found at phpfreaks.com, go4expert.com, and itknowledgeexchange.techtarget.com (at least).

    It's a shame.



    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]

  • It's actually for a computer science project. Our teacher deliberately asked us to ask around forums for help in answering this query. The other student, was I think a classmate of mine.

    Well thanks for the previous help though, our group got an A in this project.

  • rikku0801 (9/13/2010)


    It's actually for a computer science project. Our teacher deliberately asked us to ask around forums for help in answering this query. The other student, was I think a classmate of mine.

    Well thanks for the previous help though, our group got an A in this project.

    Well, I don't think the A was for you or your group. But please tell your teacher Lowell and I appreciate it - even if we can't make anything out of it 😉



    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]

  • I am deeply relieved that I'm still able to do college level homework for people. We got an A!Sometimes, in the dark of the night, I second guess myself and think people can do their own homework, so I'm very relieved the professor is giving everyone instructions on where to get the answers for the test. I'm feeling very vindicated.

    It might save everyone time if I just post my own and Lutz's home phone number, so you can call us directly, and not have to wait for us to find your homework posting in the future. waiting for days at a time for someone to post to the foorum can suck, especially if the homeowrk is due tomorrow.

    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!

  • Actually Lutz and Lowell, I think the main purpose of our professor is to see if we'll actually make an effort to ask around for help regarding this SQL query, since that's what he said in the note when he gave us the grade. It's a group effort, so my other groupmates (and classmates and their respective groups) also asked around other forums for codes regarding this SQL query, and since everyone made an effort to make an account on a forum just to ask a question, he was more than happy to give us a good grade.

    He didn't even check to see if they were indeed working or if not. Not to mention, he originally mentioned that it doesn't matter if our forum questions will elicit a response or not, just that he really just wants us to post in the forums to ask for help in this.

    So there, don't feel too bad or sarcastic about it. We were just doing what was told by our professor.

Viewing 10 posts - 1 through 10 (of 10 total)

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