DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Please help SQL noob with query!

Threaded View

  1. #1
    Join Date
    Mar 2005
    Posts
    8

    Unhappy Please help SQL noob with query!

    Hi all i have a problem with a simple query im hoping one of you clever sql junkies can help me

    ok i have a product table and am listing product id with product cost like so:

    SELECT x.id,x.cost
    FROM product x

    Now the problem occurs when i want to add another column which lists tha average cost of items. I have tried this:

    SELECT x.id,x.cost,AVG(x.cost)
    FROM product x
    GROUP BY x.id,x.cost;

    I have also tried union. But to no avail :( i presume i am using totally the wrong technique? please point me in the right direction! thx muchly
    Last edited by sambucaboy; 03-23-2005 at 12:07 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width