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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 calculation

Author  Topic 

sfalalu
Starting Member

7 Posts

Posted - 2014-06-03 : 08:04:05
Simplify the following tasks:
? Calculation of the total cost for a particular order
? Calculation of the total of all the orders placed by a particular employee in a particular month

Niit

sz1
Aged Yak Warrior

555 Posts

Posted - 2014-06-03 : 10:20:34
We need some sample data, fields...basically its this kind of query:

----Calculation of the total cost for a particular order

Select Count(OrderCost) as TotalOrderCost
From dbo.Orders
Where CustomerName = 'ABC'
Go

--Calculation of the total of all the orders placed by a particular employee in a particular month

Select Count(a.[OrderCost]) as TotalEmployeeOrderCost,
Month(OrderDate) as MonthNum
From dbo.Orders a
Inner Join dbo.Employees e
On a.OrdersID = e.EmployeeID
Where e.[Employee] = 'John Doe'
and MonthNum = 6 -- 6 for June
Go

We are the creators of our own reality!
Go to Top of Page

sfalalu
Starting Member

7 Posts

Posted - 2014-06-04 : 07:45:49
thanks guy

Niit
Go to Top of Page

sfalalu
Starting Member

7 Posts

Posted - 2014-06-05 : 07:11:35
I was told to create trigger using the same query

Niit
Go to Top of Page
   

- Advertisement -