Results 1 to 3 of 3

Thread: Same query different result

  1. #1

    Thread Starter
    Addicted Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    211

    Same query different result

    I have this query

    Code:
    SELECT 
    
    InputTable.Year, 
    AddressBook.Summary, 
    AddressBook.ID1, 
    First(AddressBook.TypeOfSchool) AS FirstOfTypeOfSchool, 
    Max(IIf([TypeOfSchool]="First Degree","Second Degree",[TypeOfSchool])) AS TypeOfSchool, 
    AddressBook.Science, 
    Count(InputTable.Sex) AS CountOfSex, 
    Sum(IIf(([YearFinished]-[FirstYearEnrolled])<=([YearsLong]-Int([FirstSemester]/2)),1,0)) AS WithingRange
    
    FROM InputTable 
    INNER JOIN AddressBook 
    ON (InputTable.Code = AddressBook.Code) AND (InputTable.SubCode = AddressBook.SubCode)
    GROUP BY 
    InputTable.Year, 
    AddressBook.Summary, 
    AddressBook.ID1, 
    AddressBook.Science;
    A year ago, I had two MS Access installations. I think the old Access got broken and then it needed to reinstalled.
    A year ago, that same query was listing one result. However when I run it now, it produces different result.

    Could there be some issue with MS Access, going from lower to upper version, or having two Access installed on the same machine?

    Something fishy in
    Code:
    Sum(IIf(([YearFinished]-[FirstYearEnrolled])<=([YearsLong]-Int([FirstSemester]/2)),1,0)) AS WithingRange
    Simply said, this query should split the input table data in two sets, one where students finished school within the possible longevity of the school and second, students needed more years to finish the school than the school lasts.

    So a year ago, i got say 2500, now when i run it i get 2000 for students finished within the longevity of the school, and those 500 go into the set for student who didn't finish in time.
    Last edited by kutlesh; Dec 5th, 2024 at 12:03 PM.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,525

    Re: Same query different result

    The Access version should not be a factor. More likely it is the data, and the additional elapsed year causing the results you are seeing. Without any data to analyze, it would be difficult for us to provide any details or run any tests.

  3. #3

    Thread Starter
    Addicted Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    211

    Re: Same query different result

    I turned out, nothing was wrong with the calculation itself. The table on which we were running the query had changed data and so, different result.

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
  •  



Click Here to Expand Forum to Full Width