expiration date query

T

Todd

I've got a vehicle database and I have a query I can run that searches for
vehicles with oil changes due that are over 5000 miles. It is based on the
most recent ending mileage and the last oil change that is entered each
month. I'd like to have something similar for the tag expiration date as
well. below is the sql code I used for the oil changes that are due. Just
wondering how to do the same for the tag expiration date (my date format is
MM/YYYY. Help!

SELECT monthlydatatbl.[Inventory #], Max(monthlydatatbl.[Oil Change
Mileage]) AS LastOilMiles, Max(monthlydatatbl.[Ending Mileage]) AS MaxMiles,
vehiclelistingtbl.[Vehicle Type], vehiclelistingtbl.[Vehicle Year],
vehiclelistingtbl.Location, vehiclelistingtbl.Division,
vehiclelistingtbl.assignedperson
FROM vehiclelistingtbl INNER JOIN monthlydatatbl ON
vehiclelistingtbl.[Inventory #] = monthlydatatbl.[Inventory #]
GROUP BY monthlydatatbl.[Inventory #], vehiclelistingtbl.[Vehicle Type],
vehiclelistingtbl.[Vehicle Year], vehiclelistingtbl.Location,
vehiclelistingtbl.Division, vehiclelistingtbl.assignedperson
HAVING (((Max([Oil Change Mileage])+5000)<Max([Ending Mileage])));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top