Forum Discussion

mikedb3434's avatar
mikedb3434
Copper Contributor
Dec 11, 2024

Aggregate query question

Hola all! New to Access, building my own DB for race results from a series here in the US for a separate project. I have one table that has nothing but race results. 
Columns that matter: 
raceCode: indexed, duplicates OK, i.e., 1949-01
start: driver's starting position, used for averages over time
finish: driver's finish, also used for averages
driverName: First and last name of driver

I'm attempting to build a query off this data that I can continue to update as I add new raw data to the table. Total starts is easy, that's a simple Count of driverName. However, trying to pick out Wins, top 5s, top 10s, etc, is driving me insane. 

If I'm looking for how many times the #1 ends up in finishes, or how many times a driver has a finish of <=5, what's the best way to write that without it throwing a data mismatch error?

  • Think this can be closed as solved. Broke apart query to simplest option (select driverName, finish from raceResults where finish BETWEEN 1 AND 5;), repeated for 1-10, then did a count query based on those results. Inefficient, but have the exports of 6 different queries feeding into a .xlsx that's run through Power Query, which manipulates the data the way I'd like to see it. 

  • mikedb3434's avatar
    mikedb3434
    Copper Contributor

    Think this can be closed as solved. Broke apart query to simplest option (select driverName, finish from raceResults where finish BETWEEN 1 AND 5;), repeated for 1-10, then did a count query based on those results. Inefficient, but have the exports of 6 different queries feeding into a .xlsx that's run through Power Query, which manipulates the data the way I'd like to see it. 

Resources