locked
MS ACCESS query question RRS feed

  • Question

  • User2062831889 posted

    I have a record set for inspections of many peices of equipment. The four cols of interest are equip_id,month,year,myData.

    My requirment is to have EXACTLY ONE Record per month for each peice of equipment.
    I have a quiery that makes the data unique over equip_id,month,year. So there is no more than one record for each month/year for a peice of equipment. But now I need to simulate data for the missing month. I want to simply go back in time to get the last peice of my data.

    So that may seem confusing, so i'll show by example.

    Given this:
    equip_id  month  year  myData
    1         1      2010  500
    1         2      2010  600
    1         5      2010  800
    2         2      2010  300
    2         4      2010  400
    2         6      2010  500

    I want this:
    equip_id  month  year  myData
    1         1      2010  500
    1         2      2010  600
    1         3      2010  600
    1         4      2010  600
    1         5      2010  800
    2         2      2010  300
    2         3      2010  300
    2         4      2010  400
    2         5      2010  400
    2         6      2010  500

    Notice that im filling in missing data with the data from the month ( or two months etc.) before. Also note that if the first record for equip 2 is in 2/2010 than I don't need a record for 1/2010 even though I have one for equip 1.

    I just need exactly one record for each month/year for each peice of equipment. So if the record does not exsist I just want to go back in time and grab the data for that record.

    Thanks!!!

    Thursday, May 27, 2010 9:03 AM

Answers

  • User338088155 posted

    Since you're using MS Access, you'll need to supplement the query with logic to build the missing month records.

    Ax 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 1, 2010 5:10 PM