SELECT SUM([BTL].dbo.OrderTable.Quantity) AS 'Totalquentity',Count(BTL.dbo.OrderTable.OrderID) as TotalOrder

            FROM [BTL].dbo.OrderTable
            JOIN [BTL].dbo.Products
            ON [BTL].dbo.OrderTable.ProductID=[BTL].dbo.Products.ProductID
            Left JOIN [BTL].dbo.Brand
            ON [BTL].dbo.Products.BrandID=[BTL].dbo.Brand.BrandID  
            WHERE  [BTL].dbo.OrderTable.EmployeeID='1' 
            Group by [BTL].dbo.Brand.BrandName,[BTL].dbo.Brand.BrandID"

            I Want to get avg

Recommended Answers

Welcome to the forum. Your post however needs work. You left out what language you were working in. Don't count on everyone thinking "it's SQL" or maybe you need the result to show on a web site.

Read the next link then update your post with your missing detail and …

Jump to Post

All 2 Replies

Replace sum with avg. But average (mean) is meaningless without standard deviation, so you'd better work that out too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.