Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Arend
Starting Member
17 Posts |
Posted - 2007-01-31 : 03:56:23
|
Hi,I have to create a view that displays the average quantity used per invoice for each product. and substitute NULL values with zeros.Please I need help and will appreciate any!I have a MATERIALDETAIL table with columns invoiceID, productCode and Quantity.THIS IS WHAT I HAVE SOFAR:*************************create view vw_ProductAverageasselect distinct product_codefrom materialdetailgoselect * from vw_productAveragego***************************PLEASE help. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-31 : 04:00:01
|
create view vw_ProductAverageasselect productcode, avg(isnull(quantity, 0.0)) as AverageQuantityfrom materialdetailgroup by productcodePeter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-31 : 04:01:35
|
[code]create view vw_ProductAverageasselect productcode, invoiceID, avg(isnull(quantity, 0.0)) as AverageQuantityfrom materialdetailgroup by productcode, invoiceID[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
|
|
|