difference between dates - for a beginner!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deebees
    New Member
    • Nov 2006
    • 3

    #1

    difference between dates - for a beginner!

    Hi everyone - I've been using a simple Access 2000 database table for some time for data for animal breeding programme. Every breeding animal has an individual record for each time there is a birth, showing the number born ... and so on. What I want to be able to do is to work out the amount of time - say as a fraction of a year - between the first and the last birth, bearing in mind that there may be anything from 3 to 10 births for any particular animal. Help please - and you need to know I'm not into programming language etc.
    Thanks in anticipation!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    DeeBees,

    Can you post the details of your record structure so far?
    It does make helping easier.

    Refer to this post for guidance (POSTING GUIDELINES: Please read carefully before posting to a forum).

    Comment

    • deebees
      New Member
      • Nov 2006
      • 3

      #3
      Originally posted by NeoPa
      DeeBees,

      Can you post the details of your record structure so far?
      It does make helping easier.

      Refer to this post for guidance (POSTING GUIDELINES: Please read carefully before posting to a forum).
      Okay - columns across from LHS are
      1. Parent ref number in question (text)
      2. date mated (the first entry will be the starting point)
      3. who mated to (text)
      4. Date of resulting birth
      5. No born alive (numeric)
      6. No alive at 12 weeks (numeric)

      There will be several lines of entires of successive matings and the resulting data. I want to be able to work out the time period between first and last matings and then divide that into the sum of the numbers alive at 12 weeks to get an annualised "going rate".

      Sorry if this is very amateur to you highly experienced professionals - I have tried getting sense from the Access "help" files without any real success so far. Thanks again in anticipation!

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by deebees
        Okay - columns across from LHS are
        1. Parent ref number in question (text)
        2. date mated (the first entry will be the starting point)
        3. who mated to (text)
        4. Date of resulting birth
        5. No born alive (numeric)
        6. No alive at 12 weeks (numeric)

        There will be several lines of entires of successive matings and the resulting data. I want to be able to work out the time period between first and last matings and then divide that into the sum of the numbers alive at 12 weeks to get an annualised "going rate".

        Sorry if this is very amateur to you highly experienced professionals - I have tried getting sense from the Access "help" files without any real success so far. Thanks again in anticipation!
        Try something like this:

        SELECT [Parent ref number in question], Max([date mated]) - Min([date mated]) As NoDaysMating, Sum([No alive at 12 weeks]) As Alive12Wks, (Alive12Wks / NoDaysMating) As goingRate
        FROM TableName
        GROUP BY [Parent ref number in question];

        Comment

        • deebees
          New Member
          • Nov 2006
          • 3

          #5
          I really do appreciate your help - looks like we got there! Thanks so much.

          Comment

          • MMcCarthy
            Recognized Expert MVP
            • Aug 2006
            • 14387

            #6
            Originally posted by deebees
            I really do appreciate your help - looks like we got there! Thanks so much.
            No problem. Glad I could help.

            Comment

            Working...