SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 calculation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sfalalu
Starting Member

Nigeria
7 Posts

Posted - 06/03/2014 :  08:04:05  Show Profile  Reply with Quote
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
Constraint Violating Yak Guru

United Kingdom
451 Posts

Posted - 06/03/2014 :  10:20:34  Show Profile  Reply with Quote
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

Nigeria
7 Posts

Posted - 06/04/2014 :  07:45:49  Show Profile  Reply with Quote
thanks guy

Niit
Go to Top of Page

sfalalu
Starting Member

Nigeria
7 Posts

Posted - 06/05/2014 :  07:11:35  Show Profile  Reply with Quote
I was told to create trigger using the same query

Niit
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000