Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I write sql statement to return last service
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00674744
Message ID:
00674768
Vues:
20
You are a true SQL guru, I should have brought it into 2 cursors to get the answer. Thanks again

Nick Patel

>I don't know how to create an sql statement for the following:
>
>
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/02
>
>
>I 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/02
or 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?
>
>thanks
>nick patel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform