We help IT Professionals succeed at work.
Get Started

SQL Statement in Enterprise Manager

264 Views
Last Modified: 2010-08-05
I am creating a view in Enterprise Manager.  I have Hours, OurRate and Revenue.  I am trying to calculate (Revenue - (Hours * OutRate) but keep getting a Negatinve (Hours * OutRate).  It is seeing the Revenue as Zero.  Here is my statement:

SELECT     dbo.Profit.Project_ID, SUM(dbo.Profit.Revenue) AS Billed, SUM(dbo.Profit.[Hour] * dbo.Profit.outRate) AS HoursCost,
                      SUM(dbo.Profit.Revenue - dbo.Profit.[Hour] * dbo.Profit.outRate) AS Profit_Loss
FROM         dbo.Company INNER JOIN
                      dbo.Profit ON dbo.Company.Company_ID = dbo.Profit.Company_ID INNER JOIN
                      dbo.Project ON dbo.Profit.Project_ID = dbo.Project.Project_ID LEFT OUTER JOIN
                      dbo.Employee ON dbo.Company.Company_Account_Executive = dbo.Employee.Employee_ID
GROUP BY dbo.Profit.Project_ID
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE