Results 1 to 1 of 1

Thread: Join with calculation for each period

  1. #1
    raulgonzalez is offline Junior Member
    Join Date
    Oct 2008
    Posts
    18

    Default Join with calculation for each period

    I have two tables: one contains employees information and another is transactions (sales) information including sales man (employeee ID)
    Table 1: employees
    code
    name
    ...

    Table 2: sales
    employee_code
    product
    Date
    Price
    Amount

    I would like to calculate how much each employees can generate revenue (total amount) for each of 2 periods (1 Jan to 30 Jun and 1 Jul to 31 Dec) or maybe any period of time - like this:

    Name _________Period 1_1_30_6______Period 1_7_31_12
    -------------------------------------------------------------------------
    Adam___________50b$______________70b$
    David___________90b$______________1000b$
    ....

    ---------------------------------

    Could you help me?
    Last edited by raulgonzalez; 10-19-2009 at 09:00 AM.

Similar Threads

  1. join with 3 tables
    By jake142 in forum Databases
    Replies: 0
    Last Post: 09-06-2009, 02:35 PM
  2. how to join table itself?
    By waney in forum Databases
    Replies: 0
    Last Post: 05-09-2009, 12:04 AM
  3. Zend_Db_Select with a join?
    By nozavroni in forum Internationalization (i18n) & Localization (l10n)
    Replies: 0
    Last Post: 08-13-2008, 06:21 PM
  4. join,left join and right join in zend_db_table
    By aniltc in forum Databases
    Replies: 0
    Last Post: 05-28-2008, 06:00 AM
  5. how to join tables?
    By zero0x in forum Databases
    Replies: 0
    Last Post: 08-18-2007, 02:16 PM

Posting Permissions

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