Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003

    Unanswered: Problems using SUM


    I am having some difficulties getting a SUM to work utilising more than one table. What I need to do is end up with a list of employees and a total for their sales. There is an Employees table, an Opportunity_Position table and a Position table. The Position table has a link to the Employee table which holds a list of all employees and a link to the Opportunity_Position table which holds the value for each opportunity. Each opportunity (and its value) is assigned to a position (many to one) and each position is assigned to an employee (one to one). Below is the SQL I have come up with, but it complains that it is not a single-group group function.

    select siebel.s_employee.last_name, sum(siebel.s_opty_postn.fcst_revn) from siebel.s_opty_postn, siebel.s_employee, siebel.s_postn where siebel.s_opty_postn.position_id = siebel.s_postn.row_id and siebel.s_postn.pr_emp_id = siebel.s_employee.row_id

    Any help that can be offered will be much appreciated.


  2. #2
    Join Date
    Nov 2002
    Desk, slightly south of keyboard

    I think you need to add

    group by siebel.s_employee.last_name

    to the end of your statement.

    Please don't email me directly with questions. I've probably just got home from the pub and cannot guarantee the sanity of my answers. In fact, I can't believe I actually made it home.

  3. #3
    Join Date
    Dec 2003
    Hi Bill,

    That worked perfectly thank you very much


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts