Vehicle Table VID VIN CAR TYPE
Service Table
SID
SERVICETYPE
SERVICEDATE
I have 2 table as show above. Vehicle table (one) has Cars that have automotive services performed and recorded in service table (many). Both tables are linked by VID and SID. I need to write a query that will show me when last certain type of service was perform for a vehicle: for example:vehicle 100 abc buick 200 xyz ford
service 100 oil 12/12/01 200 tire 12/14/01 100 oil 01/20/02 100 oil 02/12/02 200 tire 04/04/02I would like to know how to write a query that will pick the result for last service performed for example oil it should get
100 oil 02/12/02or tire it should get
200 tire 04/04/02. I know I can write a program to get the results, but I was wondering if there was a way to write SQL statement that can get the result?