Using avg function for new constructed column?
-
Hi friends, I have a two columns as unitprice and quantity in salesreport table. I am constructing new column by multplying this two column. I gave the name of sales for this new column. I want to ge average of sales column. I tried below code but program says the column name of sales is invalid. select unitprice,quantity,unitprice*quantitiy as sales from salesreport where sales>avg(sales)
-
Hi friends, I have a two columns as unitprice and quantity in salesreport table. I am constructing new column by multplying this two column. I gave the name of sales for this new column. I want to ge average of sales column. I tried below code but program says the column name of sales is invalid. select unitprice,quantity,unitprice*quantitiy as sales from salesreport where sales>avg(sales)
Please don't cross post.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Hi friends, I have a two columns as unitprice and quantity in salesreport table. I am constructing new column by multplying this two column. I gave the name of sales for this new column. I want to ge average of sales column. I tried below code but program says the column name of sales is invalid. select unitprice,quantity,unitprice*quantitiy as sales from salesreport where sales>avg(sales)
select unitprice, quantity, (unitprice*quantitiy) as sales from salesreport where (unitprice*quantitiy)> (select avg(unitprice*quantitiy) from salesreport)