Results 1 to 2 of 2

Thread: Group by Query

  1. #1
    Join Date
    Jun 2004

    Question Unanswered: Group by Query


    Please help in writing a SQL query.
    I have a table with EmpId,DirectSales,TeamLeaderId,TeamMemSales as some of the columns.The situation is
    a Team Manager as sell directly, which comes under directsales and the overriding value of his team member comes under teammemsales.

    Now I want get sum of both for a particular manager on a daily basis. Like

    SaleDate sum(Directsales) sum(TeammemSales)

    if the given id is empid then the it is directsales and if it is in teamleaderid then it is teammemsales.

    How to achieve this task in query?

    Any help is appreciated.



  2. #2
    Join Date
    Apr 2004
    Kansas City, MO
    Not sure if I'm understanding here....but I think you just need an IF statement at the beginning of the procedure to test if the id is empid or TeamLeaderID. You can then run the appropriate select based on which ID was passed in.
    When life gives you a lemon, fire the DBA.

Posting Permissions

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