Results 1 to 4 of 4

Thread: AVG in Weeks

  1. #1
    Join Date
    Oct 2013
    Posts
    7

    Unanswered: AVG in Weeks

    I have the following 2 tables which records every buying and selling of Goods as datetime

    1- Selling Table
    ------------------------------------------------------
    Date_of_Selling | product id
    ------------------------------------------------------
    15-9-2006 | 1
    25-8-2007 | 1
    13-8-2009 | 1
    16-1-2009 |1
    22-1-2010 | 1
    ..
    ..

    _______________________________________________
    and here 2nd Table
    2-Buying Table
    ----------------------------------------------------
    Date_of_Buying | Product ID
    ----------------------------------------------------
    22-9-2004 | 1
    25-16-2006 | 1
    1-8-2010 | 1
    22-8-2010 | 1
    ...
    ..
    ..


    How can I find the average number of weeks between selling and buying ...
    using timestampfunction or whatever ?
    the result should be like : 5.3 weeks between selling and buying ,
    Thanks in advance ...
    Last edited by michael0; 11-03-13 at 08:44.

  2. #2
    Join Date
    Dec 2012
    Location
    Logan, Utah
    Posts
    163
    Not enough information.

    How are the 2 tables related? Something was bought in 2004. How do I know when it was sold?

  3. #3
    Join Date
    Oct 2013
    Posts
    7
    there are product_id in each table

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Not enough information.

    Additional questions.
    (1) Please provide exact example.
    (What means 25-16-2006 | 1?
    _______________________________________________
    and here 2nd Table
    2-Buying Table
    ----------------------------------------------------
    Date_of_Buying | Product ID
    ----------------------------------------------------
    22-9-2004 | 1
    25-16-2006 | 1
    1-8-2010 | 1
    22-8-2010 | 1
    ...
    ..
    ..
    (2) How to calculate 5.3 weeks from your sample data?
    Please provide rationale(calculation).
    the result should be like : 5.3 weeks between selling and buying
    (3) Always buy and sell one thing at a time?
    For example, the following scenario need not to be considered?
    Someday bought two goods of a product, then sold one of them later. Finaly sold anoher one.

Tags for this Thread

Posting Permissions

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