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:
00674762
Vues:
18
Try
SELECT sid, servicetype, MAX(servicedate) as LastServiceDate ;
  FROM ServiceTable ;
  GROUP BY sid, servicetype ;
  INTO CURSOR crsLastService

SELECT * ;
  FROM VehicleTable ;
  LEFT JOIN crsLastService ON VehicleTable.vid = crsLastService.sid ;
  INTO CURSOR crsResult
>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:
>
< snip >
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform