AVG Expression

  • Does anyone know how to write a query that does the average for the duplicates for each name like:

    Fruit Inventory

    1 2

    1 2

    2 2

    2 2

    3 2

  • Can you please specify what your expected result would be for the example given?

    Best Regards,

    Chris Büttner

  • What have you tried and how isn't it right?

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • I want a total average for fruit 1 and total average for fruit 2 in a new column that shows one row in the new column with the average for fruit 1, fruit 2, and fruit 3.

    Hope this make sense.

    Fruit Inventory

    1 2

    1 2

    1 3

    2 4

    2 4

    I want the output to be like this:

    Fruit Inventory Average

    1 2 ?

    2 4 ?

  • Try this:

    Select Fruit, Inventory, '?' --you never defined "average of what?"

    From FruitInventory

    Group by Fruit, Inventory

    Having count(*) > 1

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

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

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