Ask Experts Questions for FREE Help !
Ask
    Kygall's Avatar
    Kygall Posts: 9, Reputation: 1
    New Member
     
    #1

    Feb 14, 2010, 07:38 PM
    SQL - join
    I need help with the following problem.

    Calculate the TOTAL actual cost for all over-budget projects managed by the manager named Graves.

    I think I'm missing something from my answer, but I'm not sure how to get it.
    I've written;
    SELECT SUM (ACTUAL_COST)
    FROM PROJECT, MANAGER
    WHERE PROJECT.ACTUAL_COST = MANAGER.MG_NAME AND MG_NAME = GRAVES

    Do I need to calculate the over-budget projects? If so, how do I write that?

    Thanks in advance for your help!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Feb 14, 2010, 07:47 PM

    First we would need to know the table structures. But your WHERE clause makes no sense. You are comparing apples and oranges.
    _Rab_'s Avatar
    _Rab_ Posts: 5, Reputation: 2
    New Member
     
    #3

    Feb 17, 2010, 05:33 AM

    Like ScottGem says, without your table structure, its difficult to say; however, the following may help you

    SELECT SUM(Project.ActualCost)
    FROM Project LEFT JOIN Manager ON Project.ManagerID = Manager.ManagerID
    GROUP BY Manager.MG_Name
    HAVING Manager.MG_Name = 'GRAVES'

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Vp to sql server [ 1 Answers ]

Front end Vb6.0, back end.. sql server 2005... connection.. can someone please help me with the code for login and password. When I change my password in sql server 2005 not connection to the vb plese help me

Sql and vb [ 2 Answers ]

How can I link sql and visual basic to work together?

My sql [ 1 Answers ]

How can I create user name and password In Ms Sql (using query analyzer) as we do in Oracle.

Sql Vs. Oracle [ 1 Answers ]

Sir, Would u explain the differences between the oracle and sql, as while working with oracle v r using sql and then executing our command.


View more questions Search