monkeymafia
March 25th, 2007, 01:40 PM
Hey
I have a simple
"CD" Table (ID, CD_Name, Cost)
it consists of 6 different cds.
I am trying to write a query that lists the name and cost of each cd. and i wish to add a column that compares the cost to the average cost. i.e difference between cost and AVG cost of all cds.
currently i have.
select cd_name, cost, avg(cost) - cost as AVG_Difference
from cd
group by cost, cd_name
but no luck.
any guidance would be appreciated
I have a simple
"CD" Table (ID, CD_Name, Cost)
it consists of 6 different cds.
I am trying to write a query that lists the name and cost of each cd. and i wish to add a column that compares the cost to the average cost. i.e difference between cost and AVG cost of all cds.
currently i have.
select cd_name, cost, avg(cost) - cost as AVG_Difference
from cd
group by cost, cd_name
but no luck.
any guidance would be appreciated