help with sql query for group by

  • How to get avg balance amount grouped by CustomerNo. Also I need to name the avg balance as "Final Balance"?

    How to get Member number and I need to name for every pair of Members who are basically located in the same town?

    How do I get the custmr number, names & member number for members who have open orders. I need to use the alias as O for the the open orders table and C for customer table. Also each customer can only appear once.

  • Homework? We can point you in the right direction but certainly won't do the work for you.

    You need to provide some more information before anybody will be able to help. Take a look at the first link in my signature about best practices for posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • And if this is homework (which it really looks like it), also show us what you have have tried so far and where you are having problems.

    We'll help you help yourself as that will be a better learning experience than us just giving you the answer(s).

  • These questions are not homework but I reading reading this SQL chapter from my book (for my class) to understand SQL. Now I am trying to solve questions at the back and these 3 questions are from my book which I can't figure out.

    I have like 10 questions, the others I believe I got but not sure how to do these 3 above.

    For 1st: I think,

    Select avg(balance amount) AS Final Balance from Customer Group By CustomerNo

    Sorry but other 2, no idea how to go about it.

    Please help

    Yes, I understand that I have limited information.

    I don't have any table structure, these are the questions I see at the end of the chapter. I just assumed that there is a column for balance amount.

    If I don't assume that what could it be ?

    I am newbie so I will deeply appreciate if you cud help me with this.

    thank you

  • The questions should be related to something else you really can't do much unless you develop your own schema to answer the question(s). Since we can't see your book from here, we really need more information from you.

    Perhaps the questions relate back to a set tables in the chapter?

  • I am out right now but will get back to you with more information. I have posted above what I think could be the answer of one of those question but not sure if it is correct.

    Will get back here soon. thank you

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

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